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 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 18 end
7 19  
8 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 22 end
18 23  
19 24 def skip_vote_open_function(pairwise_content)
... ... @@ -93,17 +98,6 @@ module PairwisePlugin::Helpers::ViewerHelper
93 98 label + textarea + hint + "<hr/>"
94 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 101 def pairwise_edit_link(label, pairwise_content)
108 102 link_target = myprofile_path(:controller => :cms, :profile => pairwise_content.profile.identifier, :action => :edit, :id => pairwise_content.id)
109 103 link_to label, link_target
... ...
plugins/pairwise/public/style.css
... ... @@ -74,10 +74,11 @@
74 74 padding: 10px 0;
75 75 border-width: 0 !important;
76 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 84 #pairwise_main .prompt.left{
... ... @@ -91,12 +92,24 @@
91 92 }
92 93  
93 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 98 display: block;
97   - max-width: 349px;
98 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 115 #pairwise_main .separator {
... ... @@ -229,7 +242,6 @@ div#pairwise_form_fields textarea {
229 242 }
230 243  
231 244 #pairwise_main div.prompt a {
232   - width:100%;
233 245 color:white;
234 246 display: block;
235 247 text-decoration: none;
... ...
plugins/pairwise/views/content_viewer/_pairwise_prompts.html.erb
... ... @@ -10,8 +10,12 @@
10 10 });
11 11 </script>
12 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 20 <% end %>
17 21 </div>
... ...
plugins/pairwise/views/content_viewer/prompt.html.erb
1 1 <% extend PairwisePlugin::Helpers::ViewerHelper %>
2 2  
3   -<%= pairwise_plugin_stylesheet %>
4   -
5 3 <% if embeded %>
6 4 <%= javascript_include_tag :defaults, 'jquery-latest.js',
7 5 'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'colorbox',
... ...
plugins/pairwise/views/pairwise_plugin_profile/result.html.erb
1 1 <% extend PairwisePlugin::Helpers::ViewerHelper %>
2 2  
3   -<%= pairwise_plugin_stylesheet %>
4   -
5 3 <h1 class="title"><%= @page.name %></h1>
6 4  
7 5 <%= render :partial => "content_viewer/result", :locals => {
... ...
plugins/pairwise/views/pairwise_plugin_suggestions/index.html.erb
1 1 <% extend PairwisePlugin::Helpers::ViewerHelper %>
2 2 <% extend PairwisePlugin::Helpers::SuggestionsHelper %>
3 3  
4   -<%= pairwise_plugin_stylesheet %>
5   -
6 4 <h1><%= _("Pairwise Question") %></h1>
7 5 <h4><%= _("Question text" ) %>: </h4><span><%= @pairwise_content.name %></span>
8 6 <div class="result_label">
... ...