Move the app layout class to the <body> element

pull/647/head
Thibaut Courouble 8 years ago
parent 69ffa7babe
commit c06d1c4d2d

@ -32,7 +32,7 @@ class app.views.SettingsPage extends app.View
return return
toggleLayout: (layout, enable) -> 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.settings.setLayout(layout, enable)
app.appCache?.updateInBackground() app.appCache?.updateInBackground()
return return

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

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

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

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

@ -14,7 +14,7 @@
<%= javascript_tag 'application', asset_host: false %><% unless App.production? %> <%= javascript_tag 'application', asset_host: false %><% unless App.production? %>
<%= javascript_tag 'debug' %><% end %> <%= javascript_tag 'debug' %><% end %>
</head> </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> <noscript class="_fail">DevDocs requires JavaScript to run.</noscript>
<%= erb :app %></body> <%= erb :app %></body>
</html> </html>

Loading…
Cancel
Save