Commit cf6a397f114dab2b751c7ac994a031657ae00f1a
1 parent
abdeb4a1
Exists in
master
fix html safe errors and wrong filter call
Showing
5 changed files
with
19 additions
and
21 deletions
Show diff stats
lib/pairwise/question.rb
... | ... | @@ -17,25 +17,23 @@ class Pairwise::Question < ActiveResource::Base |
17 | 17 | end |
18 | 18 | |
19 | 19 | def pending_choices(filter=nil, order=nil) |
20 | - find_options = { | |
21 | - :question_id => self.id, | |
22 | - :include_inactive => true, | |
23 | - :inactive_ignore_flagged => 1, | |
24 | - :filter => filter, | |
25 | - :order => order | |
26 | - } | |
20 | + find_options = {} | |
21 | + find_options[:question_id] = self.id | |
22 | + find_options[:include_inactive] = true | |
23 | + find_options[:inactive_ignore_flagged] = 1 | |
24 | + find_options[:filter] = filter unless filter.nil? | |
25 | + find_options[:order] = order | |
27 | 26 | |
28 | 27 | Pairwise::Choice.find(:all, :params => find_options) |
29 | 28 | end |
30 | 29 | |
31 | 30 | def reproved_choices(filter=nil, order=nil) |
32 | - find_options = { | |
33 | - :question_id => self.id, | |
34 | - :include_inactive => true, | |
35 | - :reproved => 1, | |
36 | - :filter => filter, | |
37 | - :order => order | |
38 | - } | |
31 | + find_options = {} | |
32 | + find_options[:question_id] = self.id | |
33 | + find_options[:include_inactive] = true | |
34 | + find_options[:reproved] = 1 | |
35 | + find_options[:filter] = filter unless filter.nil? | |
36 | + find_options[:order] = order | |
39 | 37 | |
40 | 38 | Pairwise::Choice.find(:all, :params => find_options) |
41 | 39 | end | ... | ... |
lib/pairwise_plugin/helpers/viewer_helper.rb
... | ... | @@ -9,7 +9,7 @@ module PairwisePlugin::Helpers::ViewerHelper |
9 | 9 | link_target.merge!(:source => source) if source |
10 | 10 | loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content) |
11 | 11 | |
12 | - content_tag(:div, prompt.send("#{direction}_choice_text"), :class => 'choice-text') + | |
12 | + content_tag(:div, prompt.send("#{direction}_choice_text").html_safe, :class => 'choice-text') + | |
13 | 13 | link_to_remote(_('Vote'), :loading => loading_javascript, :url => link_target, :html => {:class => 'vote-link'}) |
14 | 14 | end |
15 | 15 | ... | ... |
views/content_viewer/_prompt_body.html.erb
... | ... | @@ -5,13 +5,13 @@ |
5 | 5 | <% if pairwise_content.in_group? %> |
6 | 6 | <div class="pairwise_body"><%= pairwise_content.parent.title %></div> |
7 | 7 | <div class="body"> |
8 | - <%= pairwise_content.parent.body %> | |
8 | + <%= pairwise_content.parent.body.html_safe %> | |
9 | 9 | </div> |
10 | - <div class="group-item-title"><%= pairwise_content.title %></div> | |
10 | + <div class="group-item-title"><%= pairwise_content.title.html_safe %></div> | |
11 | 11 | <% else %> |
12 | - <div class="pairwise_body"><%= pairwise_content.title %></div> | |
12 | + <div class="pairwise_body"><%= pairwise_content.title.html_safe %></div> | |
13 | 13 | <% end %> |
14 | - <div class="pairwise_call_for_action"><%= pairwise_content.body %></div> | |
14 | + <div class="pairwise_call_for_action"><%= pairwise_content.body.html_safe %></div> | |
15 | 15 | <%= render :partial => 'content_viewer/pairwise_prompts', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :question => question, :source => (defined?(source) ? source : '') } %> |
16 | 16 | <% if embeded %> |
17 | 17 | <div class="footer"><%= _('Powered by') + ' ' + pairwise_content.environment.name%></div> | ... | ... |
views/content_viewer/_result.html.erb
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | <tbody> |
37 | 37 | <% @page.question.get_choices.each do |choice| %> |
38 | 38 | <tr> |
39 | - <td><%= choice.data %></td> | |
39 | + <td><%= choice.data.html_safe %></td> | |
40 | 40 | <td><%= choice.wins %></td> |
41 | 41 | <td><%= choice.losses %></td> |
42 | 42 | <td><%= choice.score.round.to_s %></td> | ... | ... |
views/pairwise_plugin_suggestions/index.html.erb
... | ... | @@ -135,7 +135,7 @@ |
135 | 135 | |
136 | 136 | <% @choices.each do |choice| %> |
137 | 137 | <tr> |
138 | - <td width="270px"><%= choice.data %></td> | |
138 | + <td width="270px"><%= choice.data.html_safe %></td> | |
139 | 139 | <td><%= show_date choice.created_at %></td> |
140 | 140 | <td width="105px" ><%= choice.user_created ? choice.creator_identifier : profile.identifier %></td> |
141 | 141 | <td width="50px"> | ... | ... |