[Fix #1098] add administrate custom layout to add logout link
This commit is contained in:
parent
d8d2ecf515
commit
440c2b5dd1
4 changed files with 81 additions and 0 deletions
32
app/views/layouts/manager/application.html.haml
Normal file
32
app/views/layouts/manager/application.html.haml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
-# # Application Layout
|
||||||
|
-#
|
||||||
|
-# This view template is used as the layout
|
||||||
|
-# for every page that Administrate generates.
|
||||||
|
-#
|
||||||
|
-# By default, it renders:
|
||||||
|
-# - Sidebar for navigation
|
||||||
|
-# - Content for a search bar
|
||||||
|
-# (if provided by a `content_for` block in a nested page)
|
||||||
|
-# - Flashes
|
||||||
|
-# - Links to stylesheets and Javascripts
|
||||||
|
|
||||||
|
!!!
|
||||||
|
%html{ lang: I18n.locale }
|
||||||
|
%head
|
||||||
|
%meta{ charset: "utf-8" }
|
||||||
|
%meta{ content: "NOODP", :name => "ROBOTS" }
|
||||||
|
%meta{ content: "initial-scale=1", :name => "viewport" }
|
||||||
|
%title
|
||||||
|
= content_for(:title)
|
||||||
|
| #{Rails.application.class.parent_name.titlecase}
|
||||||
|
= render "stylesheet"
|
||||||
|
= csrf_meta_tags
|
||||||
|
%body
|
||||||
|
.app-container
|
||||||
|
.sidebar
|
||||||
|
= render "sidebar"
|
||||||
|
%main.main-content{ role: "main" }
|
||||||
|
= content_for(:search)
|
||||||
|
= render "flashes"
|
||||||
|
= yield
|
||||||
|
= render "javascript"
|
16
app/views/manager/application/_flashes.html.haml
Normal file
16
app/views/manager/application/_flashes.html.haml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
-# # Flash Partial
|
||||||
|
-#
|
||||||
|
-# This partial renders flash messages on every page.
|
||||||
|
-#
|
||||||
|
-# ## Relevant Helpers:
|
||||||
|
-#
|
||||||
|
-# - `flash`:
|
||||||
|
-# Returns a hash,
|
||||||
|
-# where the keys are the type of flash (alert, error, notice, etc)
|
||||||
|
-# and the values are the message to be displayed.
|
||||||
|
|
||||||
|
- if flash.any?
|
||||||
|
.flashes
|
||||||
|
- flash.each do |key, value|
|
||||||
|
.flash{ class: "flash--#{key}" }
|
||||||
|
= value
|
16
app/views/manager/application/_javascript.html.haml
Normal file
16
app/views/manager/application/_javascript.html.haml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
-# # Javascript Partial
|
||||||
|
-#
|
||||||
|
-# This partial imports the necessary javascript on each page.
|
||||||
|
-# By default, it includes the application JS,
|
||||||
|
-# but each page can define additional JS sources
|
||||||
|
-# by providing a `content_for(:javascript)` block.
|
||||||
|
|
||||||
|
- Administrate::Engine.javascripts.each do |js_path|
|
||||||
|
= javascript_include_tag js_path
|
||||||
|
|
||||||
|
= yield :javascript
|
||||||
|
|
||||||
|
- if Rails.env.test?
|
||||||
|
= javascript_tag do
|
||||||
|
$.fx.off = true;
|
||||||
|
$.ajaxSetup({ async: false });
|
17
app/views/manager/application/_sidebar.html.haml
Normal file
17
app/views/manager/application/_sidebar.html.haml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
-# # Sidebar
|
||||||
|
-#
|
||||||
|
-# This partial is used to display the sidebar in Administrate.
|
||||||
|
-# By default, the sidebar contains navigation links
|
||||||
|
-# for all resources in the admin dashboard,
|
||||||
|
-# as defined by the routes in the `admin/` namespace
|
||||||
|
|
||||||
|
%ul.sidebar__list
|
||||||
|
%li
|
||||||
|
= link_to "Se déconnecter", administrations_sign_out_path, method: :delete, class: "sidebar__link"
|
||||||
|
|
||||||
|
%hr{ style: "margin-bottom: 0;" }
|
||||||
|
|
||||||
|
%ul.sidebar__list
|
||||||
|
- Administrate::Namespace.new(namespace).resources.each do |resource|
|
||||||
|
%li
|
||||||
|
= link_to(display_resource_name(resource), [namespace, resource], class: "sidebar__link sidebar__link--#{nav_link_state(resource)}")
|
Loading…
Reference in a new issue