diff --git a/app/assets/stylesheets/new_design/flex.scss b/app/assets/stylesheets/new_design/flex.scss index 43416c333..0689c004c 100644 --- a/app/assets/stylesheets/new_design/flex.scss +++ b/app/assets/stylesheets/new_design/flex.scss @@ -16,4 +16,8 @@ &.justify-between { justify-content: space-between; } + + &.justify-center { + justify-content: center; + } } diff --git a/app/assets/stylesheets/new_design/super_admin.scss b/app/assets/stylesheets/new_design/super_admin.scss new file mode 100644 index 000000000..949f1aa4d --- /dev/null +++ b/app/assets/stylesheets/new_design/super_admin.scss @@ -0,0 +1,11 @@ +@import "constants"; + +.super-admin { + margin-top: 40px; + text-align: center; + + h2 { + font-size: 24px; + margin-bottom: 4 * $default-spacer; + } +} diff --git a/app/controllers/administrations/sessions_controller.rb b/app/controllers/administrations/sessions_controller.rb new file mode 100644 index 000000000..5c1c66000 --- /dev/null +++ b/app/controllers/administrations/sessions_controller.rb @@ -0,0 +1,11 @@ +class Administrations::SessionsController < ApplicationController + layout "new_application" + + def new + end + + def destroy + sign_out :administration if administration_signed_in? + redirect_to root_path + end +end diff --git a/app/views/administrations/index.html.haml b/app/views/administrations/index.html.haml index c4e7eefc5..869242426 100644 --- a/app/views/administrations/index.html.haml +++ b/app/views/administrations/index.html.haml @@ -13,4 +13,4 @@ %br .text-center - = link_to 'Deconnexion', '/administrations/sign_out', method: :delete + = link_to 'Deconnexion', administrations_sign_out_path, method: :delete diff --git a/app/views/administrations/sessions/new.html.haml b/app/views/administrations/sessions/new.html.haml new file mode 100644 index 000000000..8ed5fb4d9 --- /dev/null +++ b/app/views/administrations/sessions/new.html.haml @@ -0,0 +1,6 @@ +.super-admin.flex.justify-center + %div + %h2 Espace Admin + = link_to administration_github_omniauth_authorize_path, class: "button large" do + %span.icon.lock + Connexion avec GitHub diff --git a/config/routes.rb b/config/routes.rb index e74b2385c..275c8431c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,8 +2,10 @@ Rails.application.routes.draw do get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/} devise_for :administrations, - skip: [:password, :registrations], - controllers: { omniauth_callbacks: 'administrations/omniauth_callbacks' } + skip: [:password, :registrations, :sessions], + controllers: { + omniauth_callbacks: 'administrations/omniauth_callbacks' + } devise_for :administrateurs, controllers: { sessions: 'administrateurs/sessions' @@ -44,6 +46,8 @@ Rails.application.routes.draw do get 'admin' => 'admin#index' get 'backoffice' => 'backoffice#index' + get 'administrations/sign_in' => 'administrations/sessions#new' + delete 'administrations/sign_out' => 'administrations/sessions#destroy' authenticate :administration do resources :administrations, only: [:index, :create] namespace :administrations do