]> git.openstreetmap.org Git - rails.git/commitdiff
Add layout-based class to body
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 4 Oct 2013 17:57:54 +0000 (10:57 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Sun, 13 Oct 2013 21:46:08 +0000 (14:46 -0700)
app/assets/stylesheets/common.css.scss
app/helpers/application_helper.rb

index 5d65d5994ab1bc7e71d2ae1dfdbdbe8ce4836fe3..a624706518eabfaa7386d10bbfe5b941f02da643 100644 (file)
@@ -915,11 +915,7 @@ nav.secondary {
 
 /* Rules for the sidebar and main content area */
 
 
 /* Rules for the sidebar and main content area */
 
-.site-index,
-.site-export,
-.site-edit,
-.changeset-list,
-.browse {
+.map-layout {
   #content {
     position: absolute;
     top: $headerHeight;
   #content {
     position: absolute;
     top: $headerHeight;
index f74d5cbf294722cf86243874331b0db8aa6fb823..23e3b34c5afb39c852bfca9ead0cf4455e5b9be6 100644 (file)
@@ -94,10 +94,24 @@ module ApplicationHelper
   end
 
   def body_class
   end
 
   def body_class
-    [params[:controller], "#{params[:controller]}-#{params[:action]}", @extra_body_class].compact.join(" ")
+    [
+        params[:controller],
+        "#{params[:controller]}-#{params[:action]}",
+        "#{current_layout}-layout",
+        @extra_body_class
+    ].compact.join(" ")
   end
 
   def current_page_class(path)
     :current if current_page?(path)
   end
   end
 
   def current_page_class(path)
     :current if current_page?(path)
   end
+
+  def current_layout
+    layout = controller.send(:_layout)
+    if layout.instance_of? String
+      layout
+    else
+      File.basename(layout.identifier).split('.').first
+    end
+  end
 end
 end