]> source.dussan.org Git - redmine.git/commitdiff
Added css classes to the HTML body based on the theme, controller, and action. #819
authorEric Davis <edavis@littlestreamsoftware.com>
Wed, 4 Aug 2010 01:17:45 +0000 (01:17 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Wed, 4 Aug 2010 01:17:45 +0000 (01:17 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3911 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
app/views/layouts/base.rhtml

index e407589697424619f13892de1f82b9f3842aac1f..d6fd16a6e3f6e24f6e41bdbbbeca527736ccf6cf 100644 (file)
@@ -393,6 +393,19 @@ module ApplicationHelper
     end
   end
 
+  # Returns the theme, controller name, and action as css classes for the
+  # HTML body.
+  def body_css_classes
+    css = []
+    if theme = Redmine::Themes.theme(Setting.ui_theme)
+      css << 'theme-' + theme.name
+    end
+
+    css << 'controller-' + params[:controller]
+    css << 'action-' + params[:action]
+    css.join(' ')
+  end
+
   def accesskey(s)
     Redmine::AccessKeys.key_for s
   end
index 9521457d664bab99a8bdb59e6eb311677af362eb..2daae7cb9dcafd0e8cef2326d7532baed27dff6a 100644 (file)
@@ -19,7 +19,7 @@
 <!-- page specific tags -->
 <%= yield :header_tags -%>
 </head>
-<body>
+<body class="<%= body_css_classes %>">
 <div id="wrapper">
 <div id="wrapper2">
 <div id="top-menu">