Commit 5627e2559067a0d0e2985e65e3170facd7cf6630

Authored by Carlos Purificação
Committed by Marcos Pereira
1 parent ea20a3dc
Exists in new_security

Header working for html_safe

(cherry picked from commit 463563de96088470ba6a0cf3573712d711621a46)
app/helpers/application_helper.rb
... ... @@ -1160,6 +1160,18 @@ module ApplicationHelper
1160 1160 link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system"))
1161 1161 end
1162 1162  
  1163 + def usermenu_notlogged_in
  1164 + login_str = '<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>'
  1165 + ret = _("<span class='login'>%s</span>") % modal_inline_link_to(login_str.html_safe, login_url, '#inlineLoginBox', :id => 'link_login')
  1166 + return ret.html_safe
  1167 + end
  1168 +
  1169 + def usermenu_signup
  1170 + signup_str = '<strong>' + _('Sign up') + '</strong>'
  1171 + ret = _("<span class='or'>or</span> <span class='signup'>%s</span>") % link_to(signup_str.html_safe, :controller => 'account', :action => 'signup')
  1172 + return ret.html_safe
  1173 +
  1174 + end
1163 1175 def limited_text_area(object_name, method, limit, text_area_id, options = {})
1164 1176 content_tag(:div, [
1165 1177 text_area(object_name, method, { :id => text_area_id, :onkeyup => "limited_text_area('#{text_area_id}', #{limit})" }.merge(options)),
... ...
app/helpers/layout_helper.rb
... ... @@ -40,7 +40,8 @@ module LayoutHelper
40 40  
41 41 output += templete_javascript_ng.to_s
42 42  
43   - output
  43 + # This output should be safe!
  44 + output.html_safe
44 45 end
45 46  
46 47 def noosfero_stylesheets
... ... @@ -64,7 +65,9 @@ module LayoutHelper
64 65 output << stylesheet_link_tag(global_css_pub)
65 66 end
66 67 output << stylesheet_link_tag(theme_stylesheet_path)
67   - output.join "\n"
  68 +
  69 + # This output should be safe!
  70 + output.join("\n").html_safe
68 71 end
69 72  
70 73 def noosfero_layout_features
... ...
app/views/layouts/_user.html.erb
... ... @@ -7,18 +7,19 @@
7 7 </span>
8 8 <% else %>
9 9 <span class='not-logged-in'>
10   - <%= _("<span class='login'>%s</span>") % modal_inline_link_to('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', login_url, '#inlineLoginBox', :id => 'link_login') %>
11   - <%= @plugins.dispatch(:alternative_authentication_link).collect { |content| instance_exec(&content) }.join("") %>
  10 + <%= usermenu_notlogged_in %>
  11 + <% @plugins.dispatch(:alternative_authentication_link).collect do |content|%>
  12 + <%= instance_exec(&content) %>
  13 + <%end%>
12 14  
13   - <div id='inlineLoginBox' style='display: none;'>
14   - <%= render :file => 'account/login', :locals => { :is_popin => true } %>
15   - </div>
  15 + <div id='inlineLoginBox' style='display: none;'>
  16 + <%= render :file => 'account/login', :locals => { :is_popin => true } %>
  17 + </div>
16 18  
17   - <% unless @plugins.dispatch(:allow_user_registration).include?(false) %>
18   - <%= _("<span class='or'>or</span> <span class='signup'>%s</span>") % link_to('<strong>' + _('Sign up') + '</strong>', :controller => 'account', :action => 'signup')%>
19   - <% end %>
20   -
21   - </span>
  19 + <% unless @plugins.dispatch(:allow_user_registration).include?(false) %>
  20 + <%= usermenu_signup %>
  21 + <% end %>
  22 + </span>
22 23 <% end %>
23 24 <form action="/search/articles" id="top-search" class="search_form clean" method="get">
24 25 <input name="query" size="15" title="<%=_('Search...')%>" onfocus="this.form.className='focused';" onblur="this.form.className=''" />
... ...
config/initializers/html_safe.rb
... ... @@ -3,8 +3,8 @@
3 3 # Disable Rails html autoescaping. This is due to noosfero using too much helpers/models to output html.
4 4 # It it would change too much code and make it hard to maintain.
5 5 # FIXME THIS IS SO WRONG
6   -class Object
7   - def html_safe?
8   - true
9   - end
10   -end
  6 +#class Object
  7 +# def html_safe?
  8 +# true
  9 +# end
  10 +#end
... ...