From 5627e2559067a0d0e2985e65e3170facd7cf6630 Mon Sep 17 00:00:00 2001 From: Carlos Purificacao Date: Thu, 14 May 2015 11:15:01 -0300 Subject: [PATCH] Header working for html_safe --- app/helpers/application_helper.rb | 12 ++++++++++++ app/helpers/layout_helper.rb | 7 +++++-- app/views/layouts/_user.html.erb | 21 +++++++++++---------- config/initializers/html_safe.rb | 10 +++++----- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 11f222a..88898c9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1160,6 +1160,18 @@ module ApplicationHelper link_to('' + _('Logout') + '', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) end + def usermenu_notlogged_in + login_str = '' + _('Login') + '' + ret = _("%s") % modal_inline_link_to(login_str.html_safe, login_url, '#inlineLoginBox', :id => 'link_login') + return ret.html_safe + end + + def usermenu_signup + signup_str = '' + _('Sign up') + '' + ret = _("or %s") % link_to(signup_str.html_safe, :controller => 'account', :action => 'signup') + return ret.html_safe + + end def limited_text_area(object_name, method, limit, text_area_id, options = {}) content_tag(:div, [ text_area(object_name, method, { :id => text_area_id, :onkeyup => "limited_text_area('#{text_area_id}', #{limit})" }.merge(options)), diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb index 57687c7..d1ab1a8 100644 --- a/app/helpers/layout_helper.rb +++ b/app/helpers/layout_helper.rb @@ -40,7 +40,8 @@ module LayoutHelper output += templete_javascript_ng.to_s - output + # This output should be safe! + output.html_safe end def noosfero_stylesheets @@ -64,7 +65,9 @@ module LayoutHelper output << stylesheet_link_tag(global_css_pub) end output << stylesheet_link_tag(theme_stylesheet_path) - output.join "\n" + + # This output should be safe! + output.join("\n").html_safe end def noosfero_layout_features diff --git a/app/views/layouts/_user.html.erb b/app/views/layouts/_user.html.erb index cec9a5d..25db153 100644 --- a/app/views/layouts/_user.html.erb +++ b/app/views/layouts/_user.html.erb @@ -7,18 +7,19 @@ <% else %> - <%= _("") % modal_inline_link_to('' + _('Login') + '', login_url, '#inlineLoginBox', :id => 'link_login') %> - <%= @plugins.dispatch(:alternative_authentication_link).collect { |content| instance_exec(&content) }.join("") %> + <%= usermenu_notlogged_in %> + <% @plugins.dispatch(:alternative_authentication_link).collect do |content|%> + <%= instance_exec(&content) %> + <%end%> - + - <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> - <%= _("or ") % link_to('' + _('Sign up') + '', :controller => 'account', :action => 'signup')%> - <% end %> - - + <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> + <%= usermenu_signup %> + <% end %> + <% end %>