Commit f9f8aa16d785861154ab3e912338f2aa04187d16

Authored by Victor Costa
1 parent 3f5db1c7

pairwise_plugin: added a separated link to vote

plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb
@@ -5,15 +5,25 @@ module PairwisePlugin::Helpers::ViewerHelper @@ -5,15 +5,25 @@ module PairwisePlugin::Helpers::ViewerHelper
5 stylesheet_link_tag plugin_style_sheet_path, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugin_style_sheet_path.to_s}" 5 stylesheet_link_tag plugin_style_sheet_path, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugin_style_sheet_path.to_s}"
6 end 6 end
7 7
8 - def choose_left_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)  
9 - link_target = {:controller => 'pairwise_plugin_profile', 8 + def choose_link(direction, pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
  9 + link_target = { :controller => 'pairwise_plugin_profile',
10 :profile => pairwise_content.profile.identifier, 10 :profile => pairwise_content.profile.identifier,
11 - :action => 'choose', :id => pairwise_content.id,:question_id => question.id , :prompt_id => prompt.id,  
12 - :choice_id => prompt.left_choice_id , :direction => 'left', :appearance_id => appearance_id}  
13 - link_target.merge!(:embeded => 1) if embeded  
14 - link_target.merge!(:source => source) if source  
15 - loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content)  
16 - link_to_remote prompt.left_choice_text, :loading => loading_javascript, :url => link_target 11 + :action => 'choose', :id => pairwise_content.id, :question_id => question.id , :prompt_id => prompt.id,
  12 + :choice_id => prompt.send("#{direction}_choice_id"), :direction => direction, :appearance_id => appearance_id}
  13 + link_target.merge!(:embeded => 1) if embeded
  14 + link_target.merge!(:source => source) if source
  15 + loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content)
  16 +
  17 + content_tag(:div, prompt.send("#{direction}_choice_text"), :class => 'choice-text') +
  18 + link_to_remote(_('Vote'), :loading => loading_javascript, :url => link_target)
  19 + end
  20 +
  21 + def choose_right_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
  22 + choose_link('right', pairwise_content, question, prompt, embeded, source, appearance_id)
  23 + end
  24 +
  25 + def choose_left_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
  26 + choose_link('left', pairwise_content, question, prompt, embeded, source, appearance_id)
17 end 27 end
18 28
19 def skip_vote_open_function(pairwise_content) 29 def skip_vote_open_function(pairwise_content)
@@ -93,17 +103,6 @@ module PairwisePlugin::Helpers::ViewerHelper @@ -93,17 +103,6 @@ module PairwisePlugin::Helpers::ViewerHelper
93 label + textarea + hint + "<hr/>" 103 label + textarea + hint + "<hr/>"
94 end 104 end
95 105
96 - def choose_right_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)  
97 - link_target = { :controller => 'pairwise_plugin_profile',  
98 - :profile => pairwise_content.profile.identifier,  
99 - :action => 'choose', :id => pairwise_content.id, :question_id => question.id , :prompt_id => prompt.id,  
100 - :choice_id => prompt.right_choice_id , :direction => 'right' , :appearance_id => appearance_id}  
101 - link_target.merge!(:embeded => 1) if embeded  
102 - link_target.merge!(:source => source) if source  
103 - loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content)  
104 - link_to_remote prompt.right_choice_text, :loading => loading_javascript, :url => link_target  
105 - end  
106 -  
107 def pairwise_edit_link(label, pairwise_content) 106 def pairwise_edit_link(label, pairwise_content)
108 link_target = myprofile_path(:controller => :cms, :profile => pairwise_content.profile.identifier, :action => :edit, :id => pairwise_content.id) 107 link_target = myprofile_path(:controller => :cms, :profile => pairwise_content.profile.identifier, :action => :edit, :id => pairwise_content.id)
109 link_to label, link_target 108 link_to label, link_target
plugins/pairwise/public/style.css
@@ -74,10 +74,11 @@ @@ -74,10 +74,11 @@
74 padding: 10px 0; 74 padding: 10px 0;
75 border-width: 0 !important; 75 border-width: 0 !important;
76 border-radius: 10px; 76 border-radius: 10px;
  77 + position: relative;
77 } 78 }
78 79
79 -#pairwise_main .prompt:hover {  
80 - background: url("images/prompt_bg_hover.png") no-repeat 50% top #548A1C; 80 +#pairwise_main .prompt a:hover {
  81 + background-color: #2D4D0D;
81 } 82 }
82 83
83 #pairwise_main .prompt.left{ 84 #pairwise_main .prompt.left{
@@ -91,12 +92,24 @@ @@ -91,12 +92,24 @@
91 } 92 }
92 93
93 #pairwise_main .prompt a{ 94 #pairwise_main .prompt a{
94 - color: #2a2d28 !important;  
95 - font-size: 12px; 95 + color: rgb(243, 243, 243) !important;
  96 + font-weight: bold;
  97 + font-size: 18px;
96 display: block; 98 display: block;
97 - max-width: 349px;  
98 padding: 10px; 99 padding: 10px;
99 - height: 100%; 100 + width: 80%;
  101 + height: 21px;
  102 + background-color: #548A1C;
  103 + position: absolute;
  104 + bottom: 10px;
  105 + left: 5%;
  106 + border-radius: 10px;
  107 + margin-left: auto;
  108 + margin-right: auto;
  109 +}
  110 +#pairwise_main .prompt .choice-text {
  111 + color: #2a2d28;
  112 + font-size: 15px;
100 } 113 }
101 114
102 #pairwise_main .separator { 115 #pairwise_main .separator {
@@ -229,7 +242,6 @@ div#pairwise_form_fields textarea { @@ -229,7 +242,6 @@ div#pairwise_form_fields textarea {
229 } 242 }
230 243
231 #pairwise_main div.prompt a { 244 #pairwise_main div.prompt a {
232 - width:100%;  
233 color:white; 245 color:white;
234 display: block; 246 display: block;
235 text-decoration: none; 247 text-decoration: none;
plugins/pairwise/views/content_viewer/_pairwise_prompts.html.erb
@@ -10,8 +10,12 @@ @@ -10,8 +10,12 @@
10 }); 10 });
11 </script> 11 </script>
12 <% else %> 12 <% else %>
13 - <div class="prompt left"><%= choose_left_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id) %></div>  
14 - <div class="separator"></div>  
15 - <div class="prompt right"><%= choose_right_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id ) %></div> 13 + <div class="prompt left">
  14 + <%= choose_left_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id) %>
  15 + </div>
  16 + <div class="separator"></div>
  17 + <div class="prompt right">
  18 + <%= choose_right_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id ) %>
  19 + </div>
16 <% end %> 20 <% end %>
17 </div> 21 </div>