diff --git a/plugins/mark_comment_as_read/public/public b/plugins/mark_comment_as_read/public/public new file mode 120000 index 0000000..358dfec --- /dev/null +++ b/plugins/mark_comment_as_read/public/public @@ -0,0 +1 @@ +/root/noosfero/config/plugins/mark_comment_as_read/public \ No newline at end of file diff --git a/plugins/pairwise/Gemfile b/plugins/pairwise/Gemfile new file mode 100644 index 0000000..707bb89 --- /dev/null +++ b/plugins/pairwise/Gemfile @@ -0,0 +1,5 @@ +gem 'vcr' + +group :test do + gem 'webmock' +end diff --git a/plugins/pairwise/controllers/profile/pairwise_plugin_profile_controller.rb b/plugins/pairwise/controllers/profile/pairwise_plugin_profile_controller.rb index d9b9ddd..fa94072 100644 --- a/plugins/pairwise/controllers/profile/pairwise_plugin_profile_controller.rb +++ b/plugins/pairwise/controllers/profile/pairwise_plugin_profile_controller.rb @@ -8,9 +8,9 @@ class PairwisePluginProfileController < ProfileController source = params[:source] locals = {:source => source, :pairwise_content => @pairwise_content, :embeded => embeded, :source => source, :prompt_id => prompt_id } if embeded - render 'content_viewer/prompt.rhtml', :layout => "embeded", :locals => locals + render 'content_viewer/prompt', :layout => "embeded", :locals => locals else - render 'content_viewer/prompt.rhtml', :locals => locals + render 'content_viewer/prompt', :locals => locals end end @@ -18,7 +18,7 @@ class PairwisePluginProfileController < ProfileController def load_prompt @pairwise_content = find_content(params) if request.xhr? - render 'content_viewer/prompt.rjs' + render 'content_viewer/load_prompt.rjs' else redirect_to after_action_url end @@ -28,7 +28,7 @@ class PairwisePluginProfileController < ProfileController @pairwise_content = find_content(params) vote = @pairwise_content.vote_to(params[:prompt_id], params[:direction], user_identifier, params[:appearance_id]) if request.xhr? - render 'content_viewer/prompt.rjs' + render 'content_viewer/load_prompt.rjs' else redirect_to after_action_url end @@ -41,7 +41,7 @@ class PairwisePluginProfileController < ProfileController reason = params[:reason] skip = @pairwise_content.skip_prompt(params[:prompt_id], user_identifier, params[:appearance_id], reason) if request.xhr? - render 'content_viewer/prompt.rjs' + render 'content_viewer/load_prompt.rjs' else redirect_to after_action_url end @@ -53,7 +53,7 @@ class PairwisePluginProfileController < ProfileController @page = @pairwise_content = find_content(params) if request.xhr? - render 'content_viewer/result' + render 'content_viewer/load_result.rjs' else render 'pairwise_plugin_profile/result' end diff --git a/plugins/pairwise/lib/pairwise/choice.rb b/plugins/pairwise/lib/pairwise/choice.rb index b24d5cd..e7cbd11 100644 --- a/plugins/pairwise/lib/pairwise/choice.rb +++ b/plugins/pairwise/lib/pairwise/choice.rb @@ -1,5 +1,7 @@ class Pairwise::Choice < ActiveResource::Base extend Pairwise::Resource + self.element_name = "choice" + self.format = :xml -end \ No newline at end of file +end diff --git a/plugins/pairwise/lib/pairwise/prompt.rb b/plugins/pairwise/lib/pairwise/prompt.rb index 9fae179..e973d9a 100644 --- a/plugins/pairwise/lib/pairwise/prompt.rb +++ b/plugins/pairwise/lib/pairwise/prompt.rb @@ -1,6 +1,9 @@ class Pairwise::Prompt < ActiveResource::Base extend Pairwise::Resource + self.element_name = "prompt" + self.format = :xml + # extend Resource # self.site = self.site + "questions/:question_id/" #attr_accessor :name, :question_text, :question_ideas diff --git a/plugins/pairwise/lib/pairwise/question.rb b/plugins/pairwise/lib/pairwise/question.rb index 8eda11e..972ca8e 100644 --- a/plugins/pairwise/lib/pairwise/question.rb +++ b/plugins/pairwise/lib/pairwise/question.rb @@ -2,6 +2,7 @@ class Pairwise::Question < ActiveResource::Base extend Pairwise::Resource self.element_name = "question" + self.format = :xml def get_choices(filter=nil, order=nil) Pairwise::Choice.find( diff --git a/plugins/pairwise/lib/pairwise/visitor.rb b/plugins/pairwise/lib/pairwise/visitor.rb index be4d217..3578fae 100644 --- a/plugins/pairwise/lib/pairwise/visitor.rb +++ b/plugins/pairwise/lib/pairwise/visitor.rb @@ -1,5 +1,7 @@ class Pairwise::Visitor < ActiveResource::Base extend Pairwise::Resource + self.element_name = "visitor" - + self.format = :xml + end diff --git a/plugins/pairwise/lib/pairwise_plugin/choices_related.rb b/plugins/pairwise/lib/pairwise_plugin/choices_related.rb index ff5688a..18130fd 100644 --- a/plugins/pairwise/lib/pairwise_plugin/choices_related.rb +++ b/plugins/pairwise/lib/pairwise_plugin/choices_related.rb @@ -1,10 +1,12 @@ -class PairwisePlugin::ChoicesRelated < Noosfero::Plugin::ActiveRecord +class PairwisePlugin::ChoicesRelated < ActiveRecord::Base set_table_name "pairwise_plugin_choices_related" belongs_to :question, :class_name => 'PairwisePlugin::PairwiseContent' belongs_to :user validates_presence_of :question, :choice_id, :parent_choice_id + attr_accessible :question, :choice_id, :parent_choice_id + def self.related_choices_for choice_id PairwisePlugin::ChoicesRelated.find_all_by_choice_id(choice_id) + PairwisePlugin::ChoicesRelated.find_all_by_parent_choice_id(choice_id) end diff --git a/plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb b/plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb index 59b9719..525bcbf 100644 --- a/plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb +++ b/plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb @@ -17,7 +17,7 @@ module PairwisePlugin::Helpers::ViewerHelper end def skip_vote_open_function(pairwise_content) - link_to_function _('Skip vote'), "jQuery(\"#skip_vote_reasons_#{pairwise_content.id}\").slideToggle()" + link_to_function _('Skip vote'), "jQuery('#skip_vote_reasons_#{pairwise_content.id}').slideToggle()" end def skip_vote_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil, reason = nil) diff --git a/plugins/pairwise/lib/pairwise_plugin/pairwise_content.rb b/plugins/pairwise/lib/pairwise_plugin/pairwise_content.rb index c774c30..250100b 100644 --- a/plugins/pairwise/lib/pairwise_plugin/pairwise_content.rb +++ b/plugins/pairwise/lib/pairwise_plugin/pairwise_content.rb @@ -5,7 +5,9 @@ class PairwisePlugin::PairwiseContent < Article before_save :send_question_to_service - validate_on_create :validate_choices + validate :validate_choices, :on => :create + + attr_accessible :pairwise_question_id, :allow_new_ideas, :choices, :choices_saved REASONS_ARRAY = [ {:text => _("I like both ideas"), :compare => false}, @@ -59,7 +61,7 @@ class PairwisePlugin::PairwiseContent < Article pairwise_content = self lambda do locals = {:pairwise_content => pairwise_content, :source => source, :embeded => embeded, :prompt_id => prompt_id } - render :file => 'content_viewer/prompt.rhtml', :locals => locals + render :file => 'content_viewer/prompt', :locals => locals end end @@ -83,7 +85,7 @@ class PairwisePlugin::PairwiseContent < Article begin @question ||= pairwise_client.find_question_by_id(pairwise_question_id) rescue Exception => error - errors.add_to_base(error.message) + errors.add(:base, error.message) end @question end @@ -135,7 +137,7 @@ class PairwisePlugin::PairwiseContent < Article @choices = [] else begin - @choices ||= question.get_choices.map {|q| { q.id.to_s, q.data } } + @choices ||= question.get_choices.map {|q| { q.id.to_s => q.data } } rescue @choices = [] end @@ -182,12 +184,12 @@ class PairwisePlugin::PairwiseContent < Article end def validate_choices - errors.add_to_base(_("Choices empty")) if choices.nil? - errors.add_to_base(_("Choices invalid format")) unless choices.is_a?(Array) - errors.add_to_base(_("Choices invalid")) if choices.size == 0 + errors.add(:base, _("Choices empty")) if choices.nil? + errors.add(:base, _("Choices invalid format")) unless choices.is_a?(Array) + errors.add(:base, _("Choices invalid")) if choices.size == 0 choices.each do | choice | if choice.empty? - errors.add_to_base(_("Choice empty")) + errors.add(:base, _("Choice empty")) break end end @@ -197,7 +199,7 @@ class PairwisePlugin::PairwiseContent < Article begin return pairwise_client.update_choice(question, choice_id, choice_text, active) rescue Exception => e - errors.add_to_base(N_("Choices:") + " " + N_(e.message)) + errors.add(:base, N_("Choices:") + " " + N_(e.message)) return false end end @@ -206,7 +208,7 @@ class PairwisePlugin::PairwiseContent < Article begin return pairwise_client.approve_choice(question, choice_id) rescue Exception => e - errors.add_to_base(N_("Choices:") + " " + N_(e.message)) + errors.add(:base, N_("Choices:") + " " + N_(e.message)) return false end end @@ -239,7 +241,7 @@ class PairwisePlugin::PairwiseContent < Article pairwise_client.approve_choice(question, choice.id) end rescue Exception => e - errors.add_to_base(N_("Choices: Error adding new choice to question") + N_(e.message)) + errors.add(:base, N_("Choices: Error adding new choice to question") + N_(e.message)) return false end end @@ -250,7 +252,7 @@ class PairwisePlugin::PairwiseContent < Article begin pairwise_client.update_choice(question, id, data, true) rescue Exception => e - errors.add_to_base(N_("Choices:") + " " + N_(e.message)) + errors.add(:base, (N_("Choices:") + " " + N_(e.message))) return false end end @@ -258,7 +260,7 @@ class PairwisePlugin::PairwiseContent < Article begin pairwise_client.update_question(pairwise_question_id, name) rescue Exception => e - errors.add_to_base(N_("Question not saved: ") + N_(e.message)) + errors.add(:base, (N_("Question not saved: ") + N_(e.message))) return false end end @@ -304,7 +306,7 @@ class PairwisePlugin::PairwiseContent < Article obj.pairwise_question_id = self.pairwise_question_id obj.allow_new_ideas = self.allow_new_ideas id = obj.send(:create_without_callbacks) - raise "Objeto não gravado" unless id + raise "object not saved" unless id end def copy!(options = {}) @@ -315,7 +317,7 @@ class PairwisePlugin::PairwiseContent < Article obj.pairwise_question_id = self.pairwise_question_id obj.allow_new_ideas = self.allow_new_ideas id = obj.send(:create_without_callbacks) - raise "Objeto não gravado" unless id + raise "object not saved" unless id end def page_size diff --git a/plugins/pairwise/lib/pairwise_plugin/questions_group_list_block.rb b/plugins/pairwise/lib/pairwise_plugin/questions_group_list_block.rb index a36fc65..b05fcfb 100644 --- a/plugins/pairwise/lib/pairwise_plugin/questions_group_list_block.rb +++ b/plugins/pairwise/lib/pairwise_plugin/questions_group_list_block.rb @@ -18,7 +18,7 @@ class PairwisePlugin::QuestionsGroupListBlock < Block # content += ( question ? article_to_html(question,:gallery_view => false, :format => 'full').html_safe : _('No Question selected yet.') ) #end lambda do - render :file => 'blocks/questions_group_list.rhtml', :locals => {:block => block} + render :file => 'blocks/questions_group_list', :locals => {:block => block} end end diff --git a/plugins/pairwise/test/fixtures/http_stub_fixtures.rb b/plugins/pairwise/test/fixtures/http_stub_fixtures.rb index a1c5183..20a71aa 100644 --- a/plugins/pairwise/test/fixtures/http_stub_fixtures.rb +++ b/plugins/pairwise/test/fixtures/http_stub_fixtures.rb @@ -1,7 +1,7 @@ require 'vcr' VCR.configure do |c| - c.cassette_library_dir = "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/vcr_cassettes" + c.cassette_library_dir = "#{Rails.root}/plugins/pairwise/test/fixtures/vcr_cassettes" c.hook_into :webmock end @@ -19,4 +19,4 @@ class HttpStubFixtures @client.create_question(name, choices) end end -end \ No newline at end of file +end diff --git a/plugins/pairwise/test/fixtures/pairwise_content_fixtures.rb b/plugins/pairwise/test/fixtures/pairwise_content_fixtures.rb index e5b0ba6..356ba2a 100644 --- a/plugins/pairwise/test/fixtures/pairwise_content_fixtures.rb +++ b/plugins/pairwise/test/fixtures/pairwise_content_fixtures.rb @@ -77,4 +77,4 @@ class PairwiseContentFixtures choices << Pairwise::Choice.new(:id => 2, :data => "Choice2", :wins => 0, :losses => 0, :score => 0.0) choices << Pairwise::Choice.new(:id => 3, :data => "Choice3", :wins => 0, :losses => 0, :score => 0.0) end -end \ No newline at end of file +end diff --git a/plugins/pairwise/test/functional/profile/pairwise_plugin_profile_controller_test.rb b/plugins/pairwise/test/functional/profile/pairwise_plugin_profile_controller_test.rb index d5741d5..24371b2 100644 --- a/plugins/pairwise/test/functional/profile/pairwise_plugin_profile_controller_test.rb +++ b/plugins/pairwise/test/functional/profile/pairwise_plugin_profile_controller_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" +require "#{Rails.root}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" class PairwisePluginProfileControllerTest < ActionController::TestCase @@ -35,10 +35,10 @@ class PairwisePluginProfileControllerTest < ActionController::TestCase login_as(@user.user.login) PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content) @content.expects(:question_with_prompt_for_visitor).with(@user.identifier, nil).returns(@question) - get :prompt, - :profile => @profile.identifier, + get :prompt, + :profile => @profile.identifier, :id => @content.id, - :question_id => @question.id + :question_id => @question.id assert_not_nil assigns(:pairwise_content) assert_match /#{@question.name}/, @response.body assert_match /#{@question.prompt.left_choice_text}/, @response.body @@ -49,14 +49,14 @@ class PairwisePluginProfileControllerTest < ActionController::TestCase login_as(@user.user.login) PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content) @content.expects(:question_with_prompt_for_visitor).with(@user.identifier, @question.prompt.id.to_s).returns(@question) - get :prompt, - :profile => @profile.identifier, + get :prompt, + :profile => @profile.identifier, :id => @content.id, :question_id => @question.id, - :prompt_id => @question.prompt.id - + :prompt_id => @question.prompt.id + assert_not_nil assigns(:pairwise_content) - + assert_match /#{@question.name}/, @response.body assert_match /#{@question.prompt.left_choice_text}/, @response.body assert_match /#{@question.prompt.right_choice_text}/, @response.body diff --git a/plugins/pairwise/test/unit/pairwise/client_test.rb b/plugins/pairwise/test/unit/pairwise/client_test.rb index 016ebd7..00ce778 100644 --- a/plugins/pairwise/test/unit/pairwise/client_test.rb +++ b/plugins/pairwise/test/unit/pairwise/client_test.rb @@ -3,7 +3,7 @@ require "test_helper" require 'vcr' VCR.configure do |c| - c.cassette_library_dir = "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/vcr_cassettes" + c.cassette_library_dir = "#{Rails.root}/plugins/pairwise/test/fixtures/vcr_cassettes" c.hook_into :webmock end diff --git a/plugins/pairwise/test/unit/pairwise_plugin/choices_related_test.rb b/plugins/pairwise/test/unit/pairwise_plugin/choices_related_test.rb index 83f3c33..5a0a529 100644 --- a/plugins/pairwise/test/unit/pairwise_plugin/choices_related_test.rb +++ b/plugins/pairwise/test/unit/pairwise_plugin/choices_related_test.rb @@ -1,5 +1,5 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" +require "#{Rails.root}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" class PairwisePlugin::ChoicesRelatedTest < ActiveSupport::TestCase @@ -10,31 +10,31 @@ class PairwisePlugin::ChoicesRelatedTest < ActiveSupport::TestCase should 'have choice id' do choices_related = PairwisePlugin::ChoicesRelated.new choices_related.valid? - assert choices_related.errors.invalid?(:choice_id) + assert choices_related.errors.include?(:choice_id) choices_related.choice_id = 1 choices_related.valid? - assert !choices_related.errors.invalid?(:choice_id) + assert !choices_related.errors.include?(:choice_id) end should 'have parent choice id' do choices_related = PairwisePlugin::ChoicesRelated.new choices_related.valid? - assert choices_related.errors.invalid?(:parent_choice_id) + assert choices_related.errors.include?(:parent_choice_id) choices_related.parent_choice_id = 1 choices_related.valid? - assert !choices_related.errors.invalid?(:parent_choice_id) + assert !choices_related.errors.include?(:parent_choice_id) end should 'belongs to a question' do choices_related = PairwisePlugin::ChoicesRelated.new choices_related.valid? - assert choices_related.errors.invalid?(:question) + assert choices_related.errors.include?(:question) choices_related.question = @pairwise_content choices_related.valid? - assert !choices_related.errors.invalid?(:question) + assert !choices_related.errors.include?(:question) end should 'optionally have an user' do @@ -50,4 +50,4 @@ class PairwisePlugin::ChoicesRelatedTest < ActiveSupport::TestCase assert_equal 1, PairwisePlugin::ChoicesRelated.related_choices_for(1).size assert_equal 1, PairwisePlugin::ChoicesRelated.related_choices_for(2).size end -end \ No newline at end of file +end diff --git a/plugins/pairwise/test/unit/pairwise_plugin/pairwise_content_test.rb b/plugins/pairwise/test/unit/pairwise_plugin/pairwise_content_test.rb index 35be4ab..0ca6de6 100644 --- a/plugins/pairwise/test/unit/pairwise_plugin/pairwise_content_test.rb +++ b/plugins/pairwise/test/unit/pairwise_plugin/pairwise_content_test.rb @@ -1,11 +1,11 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" -require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/http_stub_fixtures" +require "#{Rails.root}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" +require "#{Rails.root}/plugins/pairwise/test/fixtures/http_stub_fixtures" # require 'vcr' # VCR.configure do |c| -# c.cassette_library_dir = "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/vcr_cassettes" +# c.cassette_library_dir = "#{Rails.root}/plugins/pairwise/test/fixtures/vcr_cassettes" # c.hook_into :webmock # c.before_playback do |i| # puts "I in PLAYBACK: #{i.inspect}" @@ -70,7 +70,7 @@ class PairwisePlugin::PairwiseContentTest < ActiveSupport::TestCase should 'prepare prompt' do @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1') - @pairwise_content.expects(:pairwise_client).returns(@pairwise_client) + @pairwise_content.expects(:pairwise_client).returns(@pairwise_client).at_least_once @pairwise_client.expects(:question_with_prompt).with(@question.id,'any_user', nil).returns(@question) prompt = @pairwise_content.prepare_prompt('any_user') assert_not_nil prompt @@ -84,11 +84,12 @@ class PairwisePlugin::PairwiseContentTest < ActiveSupport::TestCase @pairwise_client.expects(:find_question_by_id).with(@pairwise_content.pairwise_question_id).raises(ActiveResource::ResourceNotFound.new(@response)) @pairwise_content.expects(:pairwise_client).returns(@pairwise_client) - assert_nil @pairwise_content.errors[:base] + assert @pairwise_content.errors[:base].blank? @pairwise_content.question - assert_not_nil @pairwise_content.errors[:base] - assert_equal 'Failed with 422 Any error', @pairwise_content.errors[:base] + assert !@pairwise_content.errors[:base].blank? + assert_match /Any error/, @pairwise_content.errors[:base].first + assert_match /422/, @pairwise_content.errors[:base].first end should 'send question to pairwise service' do @@ -146,7 +147,7 @@ class PairwisePlugin::PairwiseContentTest < ActiveSupport::TestCase assert_equal true, @pairwise_content.allow_new_ideas? @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false) @pairwise_content.expects(:pairwise_client).returns(@pairwise_client).at_least_once - @pairwise_client.expects(:add_new_idea).with(@question.id, "New idea").returns(true) + @pairwise_client.expects(:add_new_idea).with(@question.id, "New idea", nil).returns(true) assert_equal true, @pairwise_content.add_new_idea("New idea") end diff --git a/plugins/pairwise/test/unit/pairwise_plugin/questions_group_block_test.rb b/plugins/pairwise/test/unit/pairwise_plugin/questions_group_block_test.rb index 7229561..619e497 100644 --- a/plugins/pairwise/test/unit/pairwise_plugin/questions_group_block_test.rb +++ b/plugins/pairwise/test/unit/pairwise_plugin/questions_group_block_test.rb @@ -1,5 +1,5 @@ require 'test_helper' -require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" +require "#{Rails.root}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" class PairwisePlugin::QuestionsGroupBlockTest < ActiveSupport::TestCase @@ -25,7 +25,7 @@ class PairwisePlugin::QuestionsGroupBlockTest < ActiveSupport::TestCase end should 'have available question' do - assert_equal [@question1, @question2], @block.available_questions + assert_equivalent [@question1, @question2], @block.available_questions end should 'add multiple questions to block' do diff --git a/plugins/pairwise/views/blocks/questions_group_list.html.erb b/plugins/pairwise/views/blocks/questions_group_list.html.erb new file mode 100644 index 0000000..359a356 --- /dev/null +++ b/plugins/pairwise/views/blocks/questions_group_list.html.erb @@ -0,0 +1,46 @@ +<% extend PairwisePlugin::Helpers::ViewerHelper %> + +<%= block_title(block.title) %> + +
<%= index + 1 %>
<%= pairwise_content.title %>
<%= index + 1 %>
<%= pairwise_content.title %>
+ <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %> +
+<% else %> + <% + questions = @block.available_questions + %> +- <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %> -
-<% else %> - <% - questions = @block.available_questions - %> -+ <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %> +
+<% else %> + <% + questions = @block.available_questions + %> +- <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %> -
-<% else %> - <% - questions = @block.available_questions - %> -<%= _('Please contact the administrator') %>
++ <%= @page.errors[:base] %> ++<% else %> + + <%= render :partial => 'content_viewer/menu', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :active_tab => :results} %> + + <% cache_timeout("pairwise-result-#{pairwise_content.id}", 1.hours) do %> +
| <%= _('Choice Text') %> | +<%= _('Choice Wins') %> | +<%= _('Choice Losses') %> | +<%= _('Choice Score') %> | +
|---|---|---|---|
| <%= choice.data %> | +<%= choice.wins %> | +<%= choice.losses %> | +<%= choice.score.round.to_s %> | +
<%= _('Please contact the administrator') %>
-- <%= @page.errors[:base] %> --<% else %> - - <%= render :partial => 'content_viewer/menu', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :active_tab => :results} %> - - <% cache_timeout("pairwise-result-#{pairwise_content.id}", 1.hours) do %> -
| <%= _('Choice Text') %> | -<%= _('Choice Wins') %> | -<%= _('Choice Losses') %> | -<%= _('Choice Score') %> | -
|---|---|---|---|
| <%= choice.data %> | -<%= choice.wins %> | -<%= choice.losses %> | -<%= choice.score.round.to_s %> | -
">
+ <%= link_to_if has_param_pending_choices?, _('Ideas'), :pending => '' %>+ |
+ ">
+ <%= link_to_if ! has_param_pending_choices?, _('Suggestions'), :pending => '1', :reproved => '' %>+ |
+ |
| + | "> + <%= link_to_if has_param_reproved_choices?, _('Pending'), :pending => '1', :reproved => '' %> + | +"> + <%= link_to_if ! has_param_reproved_choices?, _('Reproved'), :pending => '1', :reproved => '1' %> + | +
| + <%= hidden_field_tag 'pending', params[:pending] %> + <%= hidden_field_tag 'reproved', params[:reproved] %> + <%= text_field_tag( + 'filter[data]', + params[:filter] ? params[:filter][:data]:'', + :placeholder => _('Type words about ideas/suggestions you\'re looking for'), + :class => "pairwise_search_field" + ) %> + | +<%= submit_button :search, _('Search') %> | +
| "> + <%= link_to_sort_choices(@pairwise_content, _("Text"), "data") %> + | +"> + <%= link_to_sort_choices(@pairwise_content, _("Date"), "created_date") %> + | +"> + <%= link_to_sort_choices(@pairwise_content, _("Author"), "visitor_identifier") %> + | ++ |
|---|---|---|---|
| <%= choice.data %> | +<%= show_date choice.created_at %> | +<%= choice.user_created ? choice.creator_identifier : profile.identifier %> | ++ <%= link_to_edit_choice(@pairwise_content, choice) unless choice.reproved %> + <% unless choice.active || choice.reproved %> + | + <%= link_to_approve_choice(@pairwise_content, choice, params)%> + | <%= link_to_reprove_idea @pairwise_content, choice, 'reprove', params %> + <% end %> + | +
">
- <%= link_to_if has_param_pending_choices?, _('Ideas'), :pending => '' %>- |
- ">
- <%= link_to_if ! has_param_pending_choices?, _('Suggestions'), :pending => '1', :reproved => '' %>- |
- |
| - | "> - <%= link_to_if has_param_reproved_choices?, _('Pending'), :pending => '1', :reproved => '' %> - | -"> - <%= link_to_if ! has_param_reproved_choices?, _('Reproved'), :pending => '1', :reproved => '1' %> - | -
| - <%= hidden_field_tag 'pending', params[:pending] %> - <%= hidden_field_tag 'reproved', params[:reproved] %> - <%= text_field_tag( - 'filter[data]', - params[:filter] ? params[:filter][:data]:'', - :placeholder => _('Type words about ideas/suggestions you\'re looking for'), - :class => "pairwise_search_field" - ) %> - | -<%= submit_button :search, _('Search') %> | -
| "> - <%= link_to_sort_choices(@pairwise_content, _("Text"), "data") %> - | -"> - <%= link_to_sort_choices(@pairwise_content, _("Date"), "created_date") %> - | -"> - <%= link_to_sort_choices(@pairwise_content, _("Author"), "visitor_identifier") %> - | -- |
|---|---|---|---|
| <%= choice.data %> | -<%= show_date choice.created_at %> | -<%= choice.user_created ? choice.creator_identifier : profile.identifier %> | -- <%= link_to_edit_choice(@pairwise_content, choice) unless choice.reproved %> - <% unless choice.active || choice.reproved %> - | - <%= link_to_approve_choice(@pairwise_content, choice, params)%> - | <%= link_to_reprove_idea @pairwise_content, choice, 'reprove', params %> - <% end %> - | -