From 8b1f22ee241909e37cfe843ac12206f4e7063296 Mon Sep 17 00:00:00 2001 From: Matthew Rider Date: Tue, 27 Aug 2024 19:52:41 +0200 Subject: [PATCH] Scope profile to organization (#1993) --- .../create_user_modal.html.erb | 2 +- .../create_user_modal/create_user_modal.rb | 10 +++++++- app/components/nav_bar/nav_bar.html.erb | 2 +- .../upgrade_business_plan_modal.html.erb | 2 +- .../user_management/user_management.html.erb | 2 +- app/controllers/profile_controller.rb | 24 ++++++++----------- config/routes.rb | 8 +++---- spec/requests/profile_spec.rb | 16 ++++++------- spec/system/profile/index_spec.rb | 12 ++++------ 9 files changed, 40 insertions(+), 38 deletions(-) diff --git a/app/components/create_user_modal/create_user_modal.html.erb b/app/components/create_user_modal/create_user_modal.html.erb index 83d13c654..506f65b78 100644 --- a/app/components/create_user_modal/create_user_modal.html.erb +++ b/app/components/create_user_modal/create_user_modal.html.erb @@ -1,5 +1,5 @@ <%= c 'modal', **attrs do %> - <%= form_with(url: profile_user_path) do %> + <%= form_with(url: organization_profile_user_path(organization)) do %> <%= c 'button', styles: [:secondary, :circular], type: 'button', diff --git a/app/components/create_user_modal/create_user_modal.rb b/app/components/create_user_modal/create_user_modal.rb index a70b1889c..50ee08b35 100644 --- a/app/components/create_user_modal/create_user_modal.rb +++ b/app/components/create_user_modal/create_user_modal.rb @@ -1,5 +1,13 @@ # frozen_string_literal: true module CreateUserModal - class CreateUserModal < ApplicationComponent; end + class CreateUserModal < ApplicationComponent + def initialize(organization:, **) + super + + @organization = organization + end + + attr_reader :organization + end end diff --git a/app/components/nav_bar/nav_bar.html.erb b/app/components/nav_bar/nav_bar.html.erb index 78e44b1c6..4273b6234 100644 --- a/app/components/nav_bar/nav_bar.html.erb +++ b/app/components/nav_bar/nav_bar.html.erb @@ -45,7 +45,7 @@ <% end %>