Commit 9a387958edf9d1439247bbe6c8d1119e18f634f3

Authored by Victor Costa
2 parents a32edc4c 3e8cadea

Merge branch 'AI2942-pairwise_plugin' into stable

plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb
1 module PairwisePlugin::Helpers::ViewerHelper 1 module PairwisePlugin::Helpers::ViewerHelper
2 2
3 - def pairwise_plugin_stylesheet  
4 - plugin_style_sheet_path = PairwisePlugin.public_path('style.css')  
5 - stylesheet_link_tag plugin_style_sheet_path, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugin_style_sheet_path.to_s}" 3 + def choose_link(direction, pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
  4 + link_target = { :controller => 'pairwise_plugin_profile',
  5 + :profile => pairwise_content.profile.identifier,
  6 + :action => 'choose', :id => pairwise_content.id, :question_id => question.id , :prompt_id => prompt.id,
  7 + :choice_id => prompt.send("#{direction}_choice_id"), :direction => direction, :appearance_id => appearance_id}
  8 + link_target.merge!(:embeded => 1) if embeded
  9 + link_target.merge!(:source => source) if source
  10 + loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content)
  11 +
  12 + content_tag(:div, prompt.send("#{direction}_choice_text"), :class => 'choice-text') +
  13 + link_to_remote(_('Vote'), :loading => loading_javascript, :url => link_target)
  14 + end
  15 +
  16 + def choose_right_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
  17 + choose_link('right', pairwise_content, question, prompt, embeded, source, appearance_id)
6 end 18 end
7 19
8 def choose_left_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil) 20 def choose_left_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
9 - link_target = {:controller => 'pairwise_plugin_profile',  
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 21 + choose_link('left', pairwise_content, question, prompt, embeded, source, appearance_id)
17 end 22 end
18 23
19 def skip_vote_open_function(pairwise_content) 24 def skip_vote_open_function(pairwise_content)
@@ -93,17 +98,6 @@ module PairwisePlugin::Helpers::ViewerHelper @@ -93,17 +98,6 @@ module PairwisePlugin::Helpers::ViewerHelper
93 label + textarea + hint + "<hr/>" 98 label + textarea + hint + "<hr/>"
94 end 99 end
95 100
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) 101 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) 102 link_target = myprofile_path(:controller => :cms, :profile => pairwise_content.profile.identifier, :action => :edit, :id => pairwise_content.id)
109 link_to label, link_target 103 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>
plugins/pairwise/views/content_viewer/prompt.html.erb
1 <% extend PairwisePlugin::Helpers::ViewerHelper %> 1 <% extend PairwisePlugin::Helpers::ViewerHelper %>
2 2
3 -<%= pairwise_plugin_stylesheet %>  
4 -  
5 <% if embeded %> 3 <% if embeded %>
6 <%= javascript_include_tag :defaults, 'jquery-latest.js', 4 <%= javascript_include_tag :defaults, 'jquery-latest.js',
7 'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'colorbox', 5 'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'colorbox',
plugins/pairwise/views/pairwise_plugin_profile/result.html.erb
1 <% extend PairwisePlugin::Helpers::ViewerHelper %> 1 <% extend PairwisePlugin::Helpers::ViewerHelper %>
2 2
3 -<%= pairwise_plugin_stylesheet %>  
4 -  
5 <h1 class="title"><%= @page.name %></h1> 3 <h1 class="title"><%= @page.name %></h1>
6 4
7 <%= render :partial => "content_viewer/result", :locals => { 5 <%= render :partial => "content_viewer/result", :locals => {
plugins/pairwise/views/pairwise_plugin_suggestions/index.html.erb
1 <% extend PairwisePlugin::Helpers::ViewerHelper %> 1 <% extend PairwisePlugin::Helpers::ViewerHelper %>
2 <% extend PairwisePlugin::Helpers::SuggestionsHelper %> 2 <% extend PairwisePlugin::Helpers::SuggestionsHelper %>
3 3
4 -<%= pairwise_plugin_stylesheet %>  
5 -  
6 <h1><%= _("Pairwise Question") %></h1> 4 <h1><%= _("Pairwise Question") %></h1>
7 <h4><%= _("Question text" ) %>: </h4><span><%= @pairwise_content.name %></span> 5 <h4><%= _("Question text" ) %>: </h4><span><%= @pairwise_content.name %></span>
8 <div class="result_label"> 6 <div class="result_label">