Commit 41feccc593331895a92717676e090333433c8017
1 parent
53ac5fd2
Exists in
master
and in
28 other branches
Encapsulate body classes
Showing
2 changed files
with
10 additions
and
8 deletions
Show diff stats
app/helpers/layout_helper.rb
| 1 | module LayoutHelper | 1 | module LayoutHelper |
| 2 | 2 | ||
| 3 | + def body_classes | ||
| 4 | + # Identify the current controller and action for the CSS: | ||
| 5 | + " controller-#{@controller.controller_name}" + | ||
| 6 | + " action-#{@controller.controller_name}-#{@controller.action_name}" + | ||
| 7 | + " template-#{profile.nil? ? "default" : profile.layout_template}" + | ||
| 8 | + (!profile.nil? && profile.is_on_homepage?(request.path,@page) ? " profile-homepage" : "") | ||
| 9 | + end | ||
| 10 | + | ||
| 3 | def noosfero_javascript | 11 | def noosfero_javascript |
| 4 | plugins_javascripts = @plugins.map { |plugin| plugin.js_files.map { |js| plugin.class.public_path(js) } }.flatten | 12 | plugins_javascripts = @plugins.map { |plugin| plugin.js_files.map { |js| plugin.class.public_path(js) } }.flatten |
| 5 | 13 |
app/views/layouts/application-ng.rhtml
| @@ -18,15 +18,9 @@ | @@ -18,15 +18,9 @@ | ||
| 18 | end.join("\n") | 18 | end.join("\n") |
| 19 | %> | 19 | %> |
| 20 | </head> | 20 | </head> |
| 21 | - <body class="<%= | ||
| 22 | - # Identify the current controller and action for the CSS: | ||
| 23 | - " controller-"+ @controller.controller_name() + | ||
| 24 | - " action-"+ @controller.controller_name() +"-"+ @controller.action_name() + | ||
| 25 | - " template-"+ ( profile.nil? ? "default" : profile.layout_template ) + | ||
| 26 | - (!profile.nil? && profile.is_on_homepage?(request.path,@page) ? " profile-homepage" : "") | ||
| 27 | - %>" > | ||
| 28 | - | 21 | + <body class="<%= body_classes %>"> |
| 29 | <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> | 22 | <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> |
| 23 | + | ||
| 30 | <%= | 24 | <%= |
| 31 | @plugins.dispatch(:body_beginning).collect do |content| | 25 | @plugins.dispatch(:body_beginning).collect do |content| |
| 32 | content.respond_to?(:call) ? content.call : content | 26 | content.respond_to?(:call) ? content.call : content |