mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
First cut of a simplified "intro" UI layout (#265)
* First cut of a simplified "intro" UI layout * Linter * Add guest role and intro-only access * Fix guest role UI defaults (#940) Use enum predicate to avoid missing role helper. * Remove legacy user role mapping (#941) Drop the unused user role references in role normalization and SSO role mapping forms to avoid implying a role that never existed. Refs: #0 * Remove role normalization (#942) Remove role normalization Roles are now stored directly without legacy mappings. * Revert role mapping logic * Remove `normalize_role_settings` * Remove unnecessary migration * Make `member` the default * Broken `.erb` --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
@@ -2,8 +2,13 @@ class PagesController < ApplicationController
|
||||
include Periodable
|
||||
|
||||
skip_authentication only: %i[redis_configuration_error privacy terms]
|
||||
before_action :ensure_intro_guest!, only: :intro
|
||||
|
||||
def dashboard
|
||||
if Current.user&.ui_layout_intro?
|
||||
redirect_to chats_path and return
|
||||
end
|
||||
|
||||
@balance_sheet = Current.family.balance_sheet
|
||||
@investment_statement = Current.family.investment_statement
|
||||
@accounts = Current.family.accounts.visible.with_attached_logo
|
||||
@@ -22,6 +27,10 @@ class PagesController < ApplicationController
|
||||
@breadcrumbs = [ [ "Home", root_path ], [ "Dashboard", nil ] ]
|
||||
end
|
||||
|
||||
def intro
|
||||
@breadcrumbs = [ [ "Home", chats_path ], [ "Intro", nil ] ]
|
||||
end
|
||||
|
||||
def update_preferences
|
||||
if Current.user.update_dashboard_preferences(preferences_params)
|
||||
head :ok
|
||||
@@ -268,4 +277,10 @@ class PagesController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def ensure_intro_guest!
|
||||
return if Current.user&.guest?
|
||||
|
||||
redirect_to root_path, alert: t("pages.intro.not_authorized", default: "Intro is only available to guest users.")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Settings::ProfilesController < ApplicationController
|
||||
layout "settings"
|
||||
layout :layout_for_settings_profile
|
||||
|
||||
def show
|
||||
@user = Current.user
|
||||
@@ -36,4 +36,10 @@ class Settings::ProfilesController < ApplicationController
|
||||
|
||||
redirect_to settings_profile_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def layout_for_settings_profile
|
||||
Current.user&.ui_layout_intro? ? "application" : "settings"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user