From e7d88b70831ba18fc6be368cd82d62139da42755 Mon Sep 17 00:00:00 2001 From: benji Date: Mon, 16 Jan 2017 21:40:09 +0100 Subject: [PATCH] Change after_sign_in_page to root and add sign_out button --- app/assets/stylesheets/menu.scss | 15 +++++++++++++++ app/controllers/application_controller.rb | 2 +- app/views/application/_menu.html.haml | 2 ++ config/routes.rb | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/menu.scss b/app/assets/stylesheets/menu.scss index a53535a..40c8a65 100644 --- a/app/assets/stylesheets/menu.scss +++ b/app/assets/stylesheets/menu.scss @@ -32,6 +32,21 @@ $color: #777; margin: 0; padding: 0; + &.menu-right { + float: right; + + .menu-item { + &:hover { + background-color: red; + color: white; + } + + &:last-child { + border-right: 0; + } + } + } + .menu-item { border-right: 1px dotted $border-color; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9c9b8f2..19d333d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,6 +27,6 @@ class ApplicationController < ActionController::Base end def after_sign_in_path_for(resource) - current_user + root_path end end diff --git a/app/views/application/_menu.html.haml b/app/views/application/_menu.html.haml index 820f8f6..6e9f4b7 100644 --- a/app/views/application/_menu.html.haml +++ b/app/views/application/_menu.html.haml @@ -17,3 +17,5 @@ = link_to user_notifications_path(User.zeus), class: 'menu-item' do Zeus Notifications %span.badge= User.zeus.notifications.size + .menu-list.menu-right + = link_to 'Sign out', sign_out_path, method: :delete, class: 'menu-item' diff --git a/config/routes.rb b/config/routes.rb index c515e96..bf1b9d5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,6 +3,10 @@ Rails.application.routes.draw do omniauth_callbacks: 'callbacks' } + devise_scope :user do + delete '/sign_out', to: 'devise/sessions#destroy' + end + authenticated :user do root 'pages#landing', as: :authenticated_root end