From f9f8aa16d785861154ab3e912338f2aa04187d16 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Wed, 8 Oct 2014 16:46:54 -0300 Subject: [PATCH] pairwise_plugin: added a separated link to vote --- plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb | 37 ++++++++++++++++++------------------- plugins/pairwise/public/style.css | 26 +++++++++++++++++++------- plugins/pairwise/views/content_viewer/_pairwise_prompts.html.erb | 10 +++++++--- 3 files changed, 44 insertions(+), 29 deletions(-) diff --git a/plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb b/plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb index 525bcbf..00414b7 100644 --- a/plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb +++ b/plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb @@ -5,15 +5,25 @@ module PairwisePlugin::Helpers::ViewerHelper stylesheet_link_tag plugin_style_sheet_path, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugin_style_sheet_path.to_s}" end - def choose_left_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil) - link_target = {:controller => 'pairwise_plugin_profile', + def choose_link(direction, pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil) + link_target = { :controller => 'pairwise_plugin_profile', :profile => pairwise_content.profile.identifier, - :action => 'choose', :id => pairwise_content.id,:question_id => question.id , :prompt_id => prompt.id, - :choice_id => prompt.left_choice_id , :direction => 'left', :appearance_id => appearance_id} - link_target.merge!(:embeded => 1) if embeded - link_target.merge!(:source => source) if source - loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content) - link_to_remote prompt.left_choice_text, :loading => loading_javascript, :url => link_target + :action => 'choose', :id => pairwise_content.id, :question_id => question.id , :prompt_id => prompt.id, + :choice_id => prompt.send("#{direction}_choice_id"), :direction => direction, :appearance_id => appearance_id} + link_target.merge!(:embeded => 1) if embeded + link_target.merge!(:source => source) if source + loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content) + + content_tag(:div, prompt.send("#{direction}_choice_text"), :class => 'choice-text') + + link_to_remote(_('Vote'), :loading => loading_javascript, :url => link_target) + end + + def choose_right_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil) + choose_link('right', pairwise_content, question, prompt, embeded, source, appearance_id) + end + + def choose_left_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil) + choose_link('left', pairwise_content, question, prompt, embeded, source, appearance_id) end def skip_vote_open_function(pairwise_content) @@ -93,17 +103,6 @@ module PairwisePlugin::Helpers::ViewerHelper label + textarea + hint + "
" end - def choose_right_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil) - link_target = { :controller => 'pairwise_plugin_profile', - :profile => pairwise_content.profile.identifier, - :action => 'choose', :id => pairwise_content.id, :question_id => question.id , :prompt_id => prompt.id, - :choice_id => prompt.right_choice_id , :direction => 'right' , :appearance_id => appearance_id} - link_target.merge!(:embeded => 1) if embeded - link_target.merge!(:source => source) if source - loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content) - link_to_remote prompt.right_choice_text, :loading => loading_javascript, :url => link_target - end - def pairwise_edit_link(label, pairwise_content) link_target = myprofile_path(:controller => :cms, :profile => pairwise_content.profile.identifier, :action => :edit, :id => pairwise_content.id) link_to label, link_target diff --git a/plugins/pairwise/public/style.css b/plugins/pairwise/public/style.css index 7ac9a7d..4f8bc7d 100644 --- a/plugins/pairwise/public/style.css +++ b/plugins/pairwise/public/style.css @@ -74,10 +74,11 @@ padding: 10px 0; border-width: 0 !important; border-radius: 10px; + position: relative; } -#pairwise_main .prompt:hover { - background: url("images/prompt_bg_hover.png") no-repeat 50% top #548A1C; +#pairwise_main .prompt a:hover { + background-color: #2D4D0D; } #pairwise_main .prompt.left{ @@ -91,12 +92,24 @@ } #pairwise_main .prompt a{ - color: #2a2d28 !important; - font-size: 12px; + color: rgb(243, 243, 243) !important; + font-weight: bold; + font-size: 18px; display: block; - max-width: 349px; padding: 10px; - height: 100%; + width: 80%; + height: 21px; + background-color: #548A1C; + position: absolute; + bottom: 10px; + left: 5%; + border-radius: 10px; + margin-left: auto; + margin-right: auto; +} +#pairwise_main .prompt .choice-text { + color: #2a2d28; + font-size: 15px; } #pairwise_main .separator { @@ -229,7 +242,6 @@ div#pairwise_form_fields textarea { } #pairwise_main div.prompt a { - width:100%; color:white; display: block; text-decoration: none; diff --git a/plugins/pairwise/views/content_viewer/_pairwise_prompts.html.erb b/plugins/pairwise/views/content_viewer/_pairwise_prompts.html.erb index 91ec8f2..1e85249 100644 --- a/plugins/pairwise/views/content_viewer/_pairwise_prompts.html.erb +++ b/plugins/pairwise/views/content_viewer/_pairwise_prompts.html.erb @@ -10,8 +10,12 @@ }); <% else %> -
<%= choose_left_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id) %>
-
-
<%= choose_right_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id ) %>
+
+ <%= choose_left_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id) %> +
+
+
+ <%= choose_right_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id ) %> +
<% end %> -- libgit2 0.21.2