21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-26 22:10:50 +02:00

Redirect home for signed up users to their checks

This commit is contained in:
Colin Darie 2018-08-30 16:25:50 +02:00
parent 54d3dbad12
commit bd7784bf8d
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
4 changed files with 17 additions and 3 deletions

View file

@ -15,6 +15,18 @@ class ApplicationController < ActionController::Base
devise_parameter_sanitizer.permit(:account_update, keys: [:notifications_enabled, :locale])
end
def after_sign_in_path_for(_resource)
checks_path
end
def after_sign_up_path_for(_resource)
checks_path
end
def after_sign_out_path_for(_resource)
root_path
end
def user_not_authorized
flash[:alert] = I18n.t("user_not_authorized", scope: :flashes)
redirect_to(request.referrer || root_path)

View file

@ -2,5 +2,7 @@
# License: GNU AGPL-3+ (see full text in LICENSE file)
class PagesController < ApplicationController
def home; end
def home
redirect_to checks_path if user_signed_in?
end
end

View file

@ -2,7 +2,7 @@
<% # License: GNU AGPL-3+ (see full text in LICENSE file) %>
<nav class="navbar navbar-expand-lg navbar-dark justify-content-between">
<div class="container-fluid">
<%= link_to root_path , class: "navbar-brand" do %>
<%= link_to (user_signed_in? ? checks_path : root_path), class: "navbar-brand" do %>
<%= image_tag 'chexpire10.png', width: 200, alt: 'chexpire logo' %>
<% end %>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

View file

@ -52,7 +52,7 @@ class UsersTest < ApplicationSystemTestCase
click_button I18n.t("devise.sessions.new.sign_in")
assert_equal root_path, page.current_path
assert_equal checks_path, page.current_path
assert page.has_content?(@user.email)
end