diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index ea0b154e5..9c6690e8c 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -113,6 +113,14 @@ class OrganisationsController < ApplicationController end end + def change_name + if current_user.support? + render "change_name", layout: "application" + else + head :unauthorized + end + end + def deactivate authorize @organisation diff --git a/app/helpers/organisations_helper.rb b/app/helpers/organisations_helper.rb index 19c77b357..1467d7c2e 100644 --- a/app/helpers/organisations_helper.rb +++ b/app/helpers/organisations_helper.rb @@ -30,7 +30,7 @@ module OrganisationsHelper if user.support? row.with_action( visually_hidden_text: organisation.name.humanize.downcase, - href: edit_organisation_path(organisation), + href: change_name_organisation_path(organisation), html_attributes: { "data-qa": "change-#{organisation.name.downcase}" }, ) else diff --git a/app/views/organisations/change_name.html.erb b/app/views/organisations/change_name.html.erb new file mode 100644 index 000000000..7b118c1eb --- /dev/null +++ b/app/views/organisations/change_name.html.erb @@ -0,0 +1,19 @@ +<% content_for :title, "Change #{@organisation.name}’s name" %> + +<% content_for :before_content do %> + <%= govuk_back_link(href: :back) %> +<% end %> + +<%= form_for(@organisation, as: :organisation, html: { method: :patch }) do |f| %> +