]> git.openstreetmap.org Git - rails.git/commitdiff
Don't rely on body classes so much
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 4 Oct 2013 18:36:53 +0000 (11:36 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Sun, 13 Oct 2013 21:46:08 +0000 (14:46 -0700)
Doesn't work well with pushState-based navigation.

app/assets/stylesheets/common.css.scss
app/controllers/site_controller.rb
app/helpers/application_helper.rb
app/views/layouts/map.html.erb

index 0c8ea4ec97f5edae6c149deaa351c90eea82999e..43d59cfb5b10fe6e502017aa7f8b00d1161413e7 100644 (file)
@@ -947,7 +947,7 @@ a.donate {
 
 /* Rules for the data browser */
 
-body.browse #sidebar_content {
+#sidebar_content {
   .browse-section {
     padding: 20px;
     border-bottom: 1px solid #CCC;
index eb8749f6f659da21af7c69252c570728fbd829c0..9979739228d87366a7ffe09ee07a928c37979cf1 100644 (file)
@@ -45,8 +45,6 @@ class SiteController < ApplicationController
       return
     end
 
-    @extra_body_class = "site-edit-#{editor}"
-
     if params[:node]
       bbox = Node.find(params[:node]).bbox.to_unscaled
       @lat = bbox.centre_lat
index 23e3b34c5afb39c852bfca9ead0cf4455e5b9be6..5d61e8c6306caca559fe6c95c4eef180dbf826e3 100644 (file)
@@ -94,24 +94,14 @@ module ApplicationHelper
   end
 
   def body_class
-    [
-        params[:controller],
-        "#{params[:controller]}-#{params[:action]}",
-        "#{current_layout}-layout",
-        @extra_body_class
-    ].compact.join(" ")
+    if content_for? :body_class
+      content_for :body_class
+    else
+      "#{params[:controller]} #{params[:controller]}-#{params[:action]}"
+    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
index d5666ed09be0f0b258b0546669696897c648fe9f..6e6caf95c6360cb98da014f713d9262a1af96f62 100644 (file)
@@ -2,6 +2,8 @@
   <%= javascript_include_tag "index" %>
 <% end %>
 
+<% content_for(:body_class) { "map-layout" } %>
+
 <% content_for :content do %>
   <div id="sidebar">
     <%= form_tag url_for(:controller => :geocoder, :action => :search), :id => "search_form" do %>