Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/earls_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def show
:with_visitor_stats => true,
:visitor_identifier => @survey_session.session_id}

show_params.merge!(:algorithm => @earl.prompt_algorithm) unless @earl.prompt_algorithm.blank?
show_params.merge!({:future_prompts => {:number => 1}, :with_average_votes => true}) if @photocracy

@question = Question.find(@earl.question_id, :params => show_params)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/prompts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def get_next_prompt_options
:with_visitor_stats => true,
:visitor_identifier => @survey_session.session_id
}
next_prompt_params.merge!(:algorithm => @earl.prompt_algorithm) unless @earl.prompt_algorithm.blank?
next_prompt_params.merge!(:future_prompts => {:number => 1}) if @photocracy
next_prompt_params
end
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,9 @@ def update

respond_to do |format|
old_lang = @earl.default_lang
if @earl.update_attributes(params[:earl].slice(:pass, :logo, :welcome_message, :default_lang, :flag_enabled, :ga_code, :question_should_autoactivate_ideas, :hide_results, :active, :show_cant_decide, :show_add_new_idea))
allowed_attributes = [:pass, :logo, :welcome_message, :default_lang, :flag_enabled, :ga_code, :question_should_autoactivate_ideas, :hide_results, :active, :show_cant_decide, :show_add_new_idea]
allowed_attributes << :prompt_algorithm if current_user.admin?
if @earl.update_attributes(params[:earl].slice(*allowed_attributes))
flash[:notice] = 'Question settings saved successfully!'
# redirect to new lang if lang was changed
if old_lang != @earl.default_lang
Expand Down
7 changes: 7 additions & 0 deletions app/views/questions/admin.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@
.controls
= # Have English be the first, but sort the rest
= f.select :default_lang, [["English", "en"]] + [["French", "fr"], ["Spanish", "es"], ["Portuguese", "pt"], ["Arabic", "ar"], ["Turkish", "tr"], ["Italian", "it"], ["Dutch", "nl"], ["Hebrew", "he"], ["German", "de"], ["Farsi", "fa"], ["Finnish", "fi"], ["Albanian", "sq"], ["Chinese", "zh"], ["Norwegian", "no"], ["Danish", "da"], ["Czech", "cs"], ["Japanese", "ja"], ["Indonesian", "id"]].sort

- if current_user.admin?
.control-group
= f.label :prompt_algorithm, "Prompt Algorithm" , :class => 'control-label'
.controls
= f.select :prompt_algorithm, [['No preference', nil], ["Catchup", "catchup"], ["All combos", "all-combos"]]

.control-group
= f.label :ga_code, t('admin.google_analytics_code') + ' ' + link_to('<i class="glyphicon glyphicon-question-sign"></i>', 'http://blog.allourideas.org/post/947544304/add-google-analytics-on-your-idea-marketplace', :target=> '_blank'), :class => 'control-label'
.controls
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20180615182055_add_prompt_algorithm_to_earl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddPromptAlgorithmToEarl < ActiveRecord::Migration
def self.up
add_column :earls, :prompt_algorithm, :string
end

def self.down
remove_column :earls, :prompt_algorithm
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20161202144215) do
ActiveRecord::Schema.define(:version => 20180615182055) do

create_table "alternatives", :force => true do |t|
t.integer "experiment_id"
Expand Down Expand Up @@ -88,6 +88,7 @@
t.string "verify_code"
t.boolean "show_cant_decide", :default => true
t.boolean "show_add_new_idea", :default => true
t.string "prompt_algorithm"
end

add_index "earls", ["question_id"], :name => "index_earls_on_question_id"
Expand Down