Commit 9172bf4b2f018b8a073eb4af0d020726d1f443c7

Authored by Alexandre Barbosa
1 parent dab58951

Fix plugins tests for html_safe

Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
app/helpers/action_tracker_helper.rb
... ... @@ -5,12 +5,12 @@ module ActionTrackerHelper
5 5 end
6 6  
7 7 def new_friendship_description ta
8   - n_('has made 1 new friend:<br />%{name}', 'has made %{num} new friends:<br />%{name}', ta.get_friend_name.size) % {
  8 + n_('has made 1 new friend:<br />%{name}', 'has made %{num} new friends:<br />%{name}', ta.get_friend_name.size).html_safe % {
9 9 num: ta.get_friend_name.size,
10   - name: ta.collect_group_with_index(:friend_name) do |n,i|
  10 + name: safe_join(ta.collect_group_with_index(:friend_name) do |n,i|
11 11 link_to image_tag(ta.get_friend_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/person-icon.png")),
12 12 ta.get_friend_url[i], title: n
13   - end.join
  13 + end)
14 14 }
15 15 end
16 16  
... ...
app/views/mailing/sender/notification.html.erb
... ... @@ -4,7 +4,7 @@
4 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5 5 </head>
6 6 <body style="margin: 0">
7   - <%= word_wrap(@message) %>
  7 + <%= raw word_wrap(@message) %>
8 8 <p>
9 9 --<br/>
10 10 <%= @signature_message %><br/>
... ...
plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb
... ... @@ -63,12 +63,12 @@ class BreadcrumbsPlugin::ContentBreadcrumbsBlock &lt; Block
63 63 breadcrumb << content_tag('div', section_name, :class => 'section-name')
64 64 end
65 65  
66   - breadcrumb
  66 + breadcrumb.html_safe
67 67 else
68 68 ''
69 69 end
70 70 end)
71   - ret.html_safe
  71 + ret
72 72 end
73 73  
74 74 def cacheable?
... ...
plugins/community_block/views/blocks/community.html.erb
... ... @@ -23,7 +23,7 @@
23 23 <%= link_to(
24 24 content_tag('span','',:class => 'community-block-button icon-arrow'),
25 25 '#',
26   - :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false;",
  26 + :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false;".html_safe,
27 27 :class => 'simplemenu-trigger') %>
28 28  
29 29 <% end %>
... ...
plugins/context_content/lib/context_content_plugin/context_content_block.rb
... ... @@ -89,13 +89,13 @@ class ContextContentPlugin::ContextContentBlock &lt; Block
89 89 ret = proc do
90 90 contents = block.contents(@page)
91 91 parent_title = block.parent_title(contents)
92   - if !contents.blank?
  92 + if contents.present?
93 93 render(:file => 'blocks/context_content', :locals => {:block => block, :contents => contents, :parent_title => parent_title})
94 94 else
95 95 ''
96 96 end
97 97 end
98   - ret.html_safe
  98 + ret
99 99 end
100 100  
101 101 def cacheable?
... ...
plugins/custom_forms/views/custom_forms_plugin_profile/show.html.erb
... ... @@ -6,9 +6,9 @@
6 6 <% if @submission.id.nil? %>
7 7 <% if @form.expired? %>
8 8 <% if @form.will_open? %>
9   - <h2><%= _('Sorry, you can\'t fill this form yet') %></h2>
  9 + <h2><%= _('Sorry, you can\'t fill this form yet').html_safe %></h2>
10 10 <% else %>
11   - <h2><%= _('Sorry, you can\'t fill this form anymore') %></h2>
  11 + <h2><%= _('Sorry, you can\'t fill this form anymore').html_safe %></h2>
12 12 <% end %>
13 13 <% end %>
14 14  
... ...
plugins/display_content/lib/display_content_block.rb
... ... @@ -177,9 +177,9 @@ class DisplayContentBlock &lt; Block
177 177  
178 178 content_sections += read_more_section if !read_more_section.blank?
179 179 #raise sections.inspect
180   - content_tag('li', content_sections)
  180 + content_tag('li', content_sections.html_safe)
181 181 end
182   - }.join(" "))
  182 + }.join(" ").html_safe)
183 183 end
184 184 end
185 185  
... ...
plugins/event/views/event_plugin/event_block_item.html.erb
... ... @@ -3,11 +3,11 @@
3 3 ev_days_tag = ''
4 4 if event.duration > 1
5 5 ev_days_tag = content_tag('time',
6   - n_('Duration: 1 day', 'Duration: %s days', event.duration) % "<b>#{event.duration}</b>",
  6 + n_('Duration: 1 day', 'Duration: %s days', event.duration).html_safe % "<b>#{event.duration}</b>".html_safe,
7 7 :itemprop => 'endDate',
8 8 :datetime => show_date(event.end_date) + 'T00:00',
9 9 :class => 'duration',
10   - :title => show_date(event.start_date) + ' &mdash; ' + time_left_str
  10 + :title => (show_date(event.start_date) + ' &mdash; ' + time_left_str).html_safe
11 11 )
12 12 end
13 13  
... ...
plugins/metadata/lib/metadata_plugin/base.rb
... ... @@ -55,7 +55,7 @@ class MetadataPlugin::Base &lt; Noosfero::Plugin
55 55 end
56 56 end
57 57 end
58   - r.join
  58 + safe_join(r)
59 59 end
60 60 end
61 61  
... ...
plugins/newsletter/lib/newsletter_plugin/newsletter.rb
... ... @@ -110,11 +110,11 @@ class NewsletterPlugin::Newsletter &lt; ActiveRecord::Base
110 110 include DatesHelper
111 111  
112 112 def message_to_public_link
113   - content_tag(:p, _("If you can't view this email, %s.") % link_to(_('click here'), '{mailing_url}'), :id => 'newsletter-public-link')
  113 + content_tag(:p, (_("If you can't view this email, %s.") % link_to(_('click here'), '{mailing_url}')).html_safe, :id => 'newsletter-public-link').html_safe
114 114 end
115 115  
116 116 def message_to_unsubscribe
117   - content_tag(:div, _("This is an automatically generated email, please do not reply. If you do not wish to receive future newsletter emails, %s.") % link_to(_("cancel your subscription here"), self.unsubscribe_url, :style => CSS['public-link']), :style => CSS['newsletter-unsubscribe'], :id => 'newsletter-unsubscribe')
  117 + content_tag(:div, _("This is an automatically generated email, please do not reply. If you do not wish to receive future newsletter emails, %s.").html_safe % link_to(_("cancel your subscription here"), self.unsubscribe_url, :style => CSS['public-link']), :style => CSS['newsletter-unsubscribe'], :id => 'newsletter-unsubscribe').html_safe
118 118 end
119 119  
120 120 def read_more(link_address)
... ... @@ -130,13 +130,13 @@ class NewsletterPlugin::Newsletter &lt; ActiveRecord::Base
130 130 end
131 131  
132 132 def body(data = {})
133   - content_tag(:div, content_tag(:div, message_to_public_link, :style => CSS['newsletter-public-link'])+content_tag(:table,(self.image.nil? ? '' : content_tag(:tr, content_tag(:th, tag(:img, :src => "#{self.environment.top_url}#{self.image.public_filename}", :style => CSS['header-image']),:colspan => 2),:style => CSS['newsletter-header']))+self.posts(data).map do |post|
  133 + content_tag(:div, content_tag(:div, message_to_public_link, :style => CSS['newsletter-public-link']).html_safe+content_tag(:table,(self.image.nil? ? '' : content_tag(:tr, content_tag(:th, tag(:img, :src => "#{self.environment.top_url}#{self.image.public_filename}", :style => CSS['header-image']),:colspan => 2),:style => CSS['newsletter-header'])).html_safe+self.posts(data).map do |post|
134 134 if post.image
135 135 post_with_image(post)
136 136 else
137 137 post_without_image(post)
138 138 end
139   - end.join()+content_tag(:tr, content_tag(:td, self.footer, :colspan => 2)),:style => CSS['breakingnews'])+content_tag(:div,message_to_unsubscribe, :style => CSS['newsletter-unsubscribe']),:style => CSS['breakingnews-wrap'])
  139 + end.join().html_safe+content_tag(:tr, content_tag(:td, self.footer, :colspan => 2)),:style => CSS['breakingnews']).html_safe+content_tag(:div,message_to_unsubscribe, :style => CSS['newsletter-unsubscribe']),:style => CSS['breakingnews-wrap']).html_safe
140 140 end
141 141  
142 142 def default_subject
... ...
plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin.rb
... ... @@ -17,7 +17,7 @@ class RequireAuthToCommentPlugin &lt; Noosfero::Plugin
17 17 end
18 18  
19 19 def profile_editor_extras
20   - expanded_template('profile-editor-extras.html.erb')
  20 + expanded_template('profile-editor-extras.html.erb').html_safe
21 21 end
22 22  
23 23 def stylesheet?
... ...
plugins/site_tour/views/tour_actions.html.erb
... ... @@ -6,11 +6,11 @@
6 6 <script>
7 7 jQuery( document ).ready(function( $ ) {
8 8 <% actions.each_with_index do |action, index| %>
9   - <%= "siteTourPlugin.add('#{j action[:group_name]}', '#{j action[:selector]}', '#{j parse_tour_description(action[:description])}', #{index + 1});" %>
  9 + <%= raw "siteTourPlugin.add('#{j action[:group_name]}', '#{j action[:selector]}', '#{j parse_tour_description(action[:description])}', #{index + 1});" %>
10 10 <% end %>
11 11  
12 12 <% (group_triggers||[]).each do |group| %>
13   - <%= "siteTourPlugin.addGroupTrigger('#{j group[:group_name]}', '#{j group[:selector]}', '#{j group[:event]}');" %>
  13 + <%= "siteTourPlugin.addGroupTrigger('#{j group[:group_name]}', '#{j group[:selector]}', '#{j group[:event]}');".html_safe %>
14 14 <% end %>
15 15  
16 16 siteTourPlugin.setOption('nextLabel', '<%= _('Next') %>');
... ...
plugins/sniffer/views/sniffer_plugin_myprofile/search.html.erb
... ... @@ -46,8 +46,8 @@
46 46 var currentProfile = <%= filter_visible_attr_profile(profile).to_json %>;
47 47 sniffer.search.map.load({
48 48 "zoom": <%= GoogleMaps.initial_zoom.to_json %>,
49   - "balloonUrl": <%= url_for(:controller => :sniffer_plugin_myprofile, :action => :map_balloon, :id => "_id_", :escape => false).to_json %>,
50   - "myBalloonUrl": <%= url_for(:controller => :sniffer_plugin_myprofile, :action => :my_map_balloon, :escape => false).to_json %>,
  49 + "balloonUrl": <%= raw url_for(:controller => :sniffer_plugin_myprofile, :action => :map_balloon, :id => "_id_", :escape => false).to_json %>,
  50 + "myBalloonUrl": <%= raw url_for(:controller => :sniffer_plugin_myprofile, :action => :my_map_balloon, :escape => false).to_json %>,
51 51 "profiles": <%=
52 52 @profiles_data.map do |id, profile_data|
53 53 data = filter_visible_attr_profile(profile_data[:profile])
... ... @@ -55,7 +55,7 @@
55 55 data[:suppliersProducts] = filter_visible_attr_suppliers_products(profile_data[:suppliers_products])
56 56 data[:icon] = profile_data[:profile][:icon]
57 57 data
58   - end.to_json
  58 + end.to_json.html_safe
59 59 %>
60 60 });
61 61 </script>
... ...