Преглед на файлове

Move the app layout class to the <body> element

Thibaut Courouble преди 8 години
родител
ревизия
c06d1c4d2d

+ 1 - 1
assets/javascripts/views/content/settings_page.coffee

@@ -32,7 +32,7 @@ class app.views.SettingsPage extends app.View
     return
 
   toggleLayout: (layout, enable) ->
-    app.el.classList[if enable then 'add' else 'remove'](layout) unless layout is SIDEBAR_HIDDEN_LAYOUT
+    document.body.classList[if enable then 'add' else 'remove'](layout) unless layout is SIDEBAR_HIDDEN_LAYOUT
     app.settings.setLayout(layout, enable)
     app.appCache?.updateInBackground()
     return

+ 2 - 2
assets/javascripts/views/layout/settings.coffee

@@ -22,7 +22,7 @@ class app.views.Settings extends app.View
   activate: ->
     if super
       @render()
-      app.el.classList.remove(SIDEBAR_HIDDEN_LAYOUT)
+      document.body.classList.remove(SIDEBAR_HIDDEN_LAYOUT)
       app.appCache?.on 'progress', @onAppCacheProgress
     return
 
@@ -30,7 +30,7 @@ class app.views.Settings extends app.View
     if super
       @resetClass()
       @docPicker.detach()
-      app.el.classList.add(SIDEBAR_HIDDEN_LAYOUT) if app.settings.hasLayout(SIDEBAR_HIDDEN_LAYOUT)
+      document.body.classList.add(SIDEBAR_HIDDEN_LAYOUT) if app.settings.hasLayout(SIDEBAR_HIDDEN_LAYOUT)
       app.appCache?.off 'progress', @onAppCacheProgress
     return
 

+ 1 - 1
assets/stylesheets/components/_app.scss

@@ -11,7 +11,7 @@
   ._booting > & { opacity: 0; }
   ._noscript > & { display: none; }
 
-  &._max-width  {
+  ._max-width & {
     margin: 0 auto;
     max-width: $maxWidth;
     box-shadow: 1px 0 $headerBorder, -1px 0 $headerBorder;

+ 1 - 1
views/app.erb

@@ -1,4 +1,4 @@
-<div class="_app<%= " #{app_layout}" if app_layout %>" role="application">
+<div class="_app" role="application">
   <header class="_header" role="banner">
     <button type="button" aria-label="Toggle navigation" class="_header-btn" data-toggle-sidebar hidden>
       <svg viewBox="0 0 24 24"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path></svg>

+ 1 - 1
views/index.erb

@@ -34,7 +34,7 @@
   <%= javascript_tag 'docs' %><% unless App.production? %>
   <%= javascript_tag 'debug' %><% end %>
 </head>
-<body class="_booting _noscript">
+<body class="_booting _noscript<%= " #{app_layout}" if app_layout %>">
 <noscript class="_fail">DevDocs requires JavaScript to run.</noscript>
 <%= erb :app %></body>
 </html>

+ 1 - 1
views/other.erb

@@ -14,7 +14,7 @@
   <%= javascript_tag 'application', asset_host: false %><% unless App.production? %>
   <%= javascript_tag 'debug' %><% end %>
 </head>
-<body class="_booting _noscript" data-doc="<%= CGI::escape_html @doc.to_json %>">
+<body class="_booting _noscript<%= " #{app_layout}" if app_layout %>" data-doc="<%= CGI::escape_html @doc.to_json %>">
 <noscript class="_fail">DevDocs requires JavaScript to run.</noscript>
 <%= erb :app %></body>
 </html>