From ea28ae59102bf1e8b33c0ebdd86a0c6e3a2eea8d Mon Sep 17 00:00:00 2001 From: Mike Dalton Date: Thu, 2 Jul 2026 17:40:56 -0400 Subject: [PATCH] Add signed-in dashboard and "About you" page Give signed-in members a dedicated workspace dashboard that links to their story ("About you") and the scenarios explorer, instead of landing on the marketing home page. - Add DashboardsController (resource :dashboard) rendering a two-card workspace; sign-in and the nav logo now point signed-in users here. The marketing home page is unchanged and still reachable. - Add an "About you" page (Users::StoriesController) storing background, family, and formative_experiences on users. The form autosaves via the debounced_form Stimulus controller; the autosave responds with a turbo-stream that appends a "Saved." toast instead of redirecting, so scroll position and focus are preserved. - Extract shared/_toast partial so a single flash toast can be rendered both on page load and via turbo-stream. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/controllers/concerns/authentication.rb | 2 +- app/controllers/dashboards_controller.rb | 4 ++ app/controllers/users/stories_controller.rb | 28 ++++++++ app/views/dashboards/show.html.erb | 29 +++++++++ app/views/layouts/application.html.erb | 3 +- app/views/shared/_flash.html.erb | 14 +--- app/views/shared/_toast.html.erb | 12 ++++ app/views/users/stories/show.html.erb | 39 +++++++++++ config/routes.rb | 2 + .../20260702195446_add_about_you_to_users.rb | 7 ++ db/schema.rb | 5 +- .../controllers/dashboards_controller_test.rb | 29 +++++++++ .../email_confirmations_controller_test.rb | 2 +- test/controllers/home_controller_test.rb | 7 +- .../magic_links_controller_test.rb | 4 +- test/controllers/sessions_controller_test.rb | 2 +- .../users/stories_controller_test.rb | 64 +++++++++++++++++++ 17 files changed, 231 insertions(+), 22 deletions(-) create mode 100644 app/controllers/dashboards_controller.rb create mode 100644 app/controllers/users/stories_controller.rb create mode 100644 app/views/dashboards/show.html.erb create mode 100644 app/views/shared/_toast.html.erb create mode 100644 app/views/users/stories/show.html.erb create mode 100644 db/migrate/20260702195446_add_about_you_to_users.rb create mode 100644 test/controllers/dashboards_controller_test.rb create mode 100644 test/controllers/users/stories_controller_test.rb diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb index 8ecf72d..a819597 100644 --- a/app/controllers/concerns/authentication.rb +++ b/app/controllers/concerns/authentication.rb @@ -35,7 +35,7 @@ def request_authentication end def after_authentication_url - session.delete(:return_to_after_authenticating) || root_url + session.delete(:return_to_after_authenticating) || dashboard_url end def start_new_session_for(user) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb new file mode 100644 index 0000000..aed6610 --- /dev/null +++ b/app/controllers/dashboards_controller.rb @@ -0,0 +1,4 @@ +class DashboardsController < ApplicationController + def show + end +end diff --git a/app/controllers/users/stories_controller.rb b/app/controllers/users/stories_controller.rb new file mode 100644 index 0000000..11cde67 --- /dev/null +++ b/app/controllers/users/stories_controller.rb @@ -0,0 +1,28 @@ +class Users::StoriesController < ApplicationController + def show + @user = Current.user + end + + def update + @user = Current.user + + if @user.update(story_params) + respond_to do |format| + format.turbo_stream do + render turbo_stream: turbo_stream.append( + "flash", partial: "shared/toast", locals: { type: :notice, message: "Saved." } + ) + end + format.html { redirect_to users_story_path, notice: "Saved." } + end + else + render :show, status: :unprocessable_entity + end + end + + private + + def story_params + params.require(:user).permit(:background, :family, :formative_experiences) + end +end diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb new file mode 100644 index 0000000..e8795ef --- /dev/null +++ b/app/views/dashboards/show.html.erb @@ -0,0 +1,29 @@ +
+

Welcome to your workspace

+

+ Take your time exploring. There's no rush to complete anything — move through it at your + own pace, and come back whenever you're ready. +

+ +

Your story

+ +
+ <%= link_to users_story_path, + class: "block rounded-2xl border border-line bg-surface p-6 shadow-sm hover:shadow-md transition" do %> +

About you

+

+ Share your background, family, and experiences that shaped who you are. This creates a + personal record for your family and provides context for your advisors. +

+ <% end %> + + <%= link_to scenarios_path, + class: "block rounded-2xl border border-line bg-surface p-6 shadow-sm hover:shadow-md transition" do %> +

Explore options

+

+ Experiment with allocations and possibilities to compare different approaches and potential + outcomes. Explore at your own pace to find what aligns with your values and goals. +

+ <% end %> +
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 01b44fd..b5f3f09 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -29,7 +29,7 @@