From 00818309a408cd00b0560488e89369a815d689cb Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:31:47 +0000 Subject: [PATCH] Conditionally add the margin-bottom-6 ro button groups, only if there is an action button to show --- app/components/create_log_actions_component.html.erb | 2 +- app/views/organisations/schemes.html.erb | 5 +++-- app/views/organisations/users.html.erb | 5 +++-- app/views/schemes/index.html.erb | 5 +++-- app/views/users/index.html.erb | 5 +++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/components/create_log_actions_component.html.erb b/app/components/create_log_actions_component.html.erb index 6da1760e8..805cf02e5 100644 --- a/app/components/create_log_actions_component.html.erb +++ b/app/components/create_log_actions_component.html.erb @@ -1,4 +1,4 @@ -
+
"> <% if display_actions? %> <%= govuk_button_to create_button_copy, create_button_href, class: "govuk-!-margin-right-3" %> <% unless user.support? %> diff --git a/app/views/organisations/schemes.html.erb b/app/views/organisations/schemes.html.erb index 2eb86162a..692dd9ef1 100644 --- a/app/views/organisations/schemes.html.erb +++ b/app/views/organisations/schemes.html.erb @@ -22,8 +22,9 @@ <% end %>
-
- <% if SchemePolicy.new(current_user, nil).create? %> + <% display_actions = SchemePolicy.new(current_user, nil).create? %> +
"> + <% if display_actions %> <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> <% end %>
diff --git a/app/views/organisations/users.html.erb b/app/views/organisations/users.html.erb index 73a460276..78a611ea9 100644 --- a/app/views/organisations/users.html.erb +++ b/app/views/organisations/users.html.erb @@ -13,8 +13,9 @@ <% end %>
-
- <% if current_user.data_coordinator? || current_user.support? %> + <% display_actions = current_user.data_coordinator? || current_user.support? %> +
"> + <% if display_actions %> <%= govuk_button_link_to "Invite user", new_user_path(organisation_id: @organisation.id), html: { method: :get } %> <% end %>
diff --git a/app/views/schemes/index.html.erb b/app/views/schemes/index.html.erb index a443a2dae..bd8cee387 100644 --- a/app/views/schemes/index.html.erb +++ b/app/views/schemes/index.html.erb @@ -6,8 +6,9 @@ <%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Supported housing schemes", sub: nil } : { main: "Supported housing schemes", sub: current_user.organisation.name } %>
-
- <% if SchemePolicy.new(current_user, nil).create? %> + <% display_actions = SchemePolicy.new(current_user, nil).create? %> +
"> + <% if display_actions %> <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> <% end %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index c644d200a..bf19706cc 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -6,8 +6,9 @@ <%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Users", sub: nil } : { main: "Users", sub: current_user.organisation.name } %>
-
- <% if current_user.data_coordinator? || current_user.support? %> + <% display_actions = current_user.data_coordinator? || current_user.support? %> +
"> + <% if display_actions %> <%= govuk_button_link_to "Invite user", new_user_path, html: { method: :get } %> <% end %>