diff --git a/app/helpers/organisation_helper.rb b/app/helpers/organisation_helper.rb new file mode 100644 index 000000000..68fa98242 --- /dev/null +++ b/app/helpers/organisation_helper.rb @@ -0,0 +1,11 @@ +module OrganisationHelper + def organisation_header(path, user, current_organisation) + if path == "/organisations" + "Organisations" + elsif user.organisation_id == current_organisation.id + "Your organisation" + else + current_organisation.name + end + end +end diff --git a/app/views/layouts/organisations.html.erb b/app/views/layouts/organisations.html.erb index d591b5813..196ee199f 100644 --- a/app/views/layouts/organisations.html.erb +++ b/app/views/layouts/organisations.html.erb @@ -1,6 +1,6 @@ <% content_for :content do %>

- <%= request.path == "/organisations" ? "Organisations" : "Your organisation" %> + <%= organisation_header(request.path, current_user, @organisation)%>

<% items = tab_items(current_user) %> diff --git a/app/views/organisations/logs.erb b/app/views/organisations/logs.erb index 7a11b745e..1a82696d1 100644 --- a/app/views/organisations/logs.erb +++ b/app/views/organisations/logs.erb @@ -5,10 +5,10 @@ <%= content_for(:title) %>
-<%= render NavigationComponent.new( - items: secondary_items(request.path, @organisation.id), - level: "sub" - ) %> + <%= render NavigationComponent.new( + items: secondary_items(request.path, @organisation.id), + level: "sub" + ) %>
diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb index 50eb5d5fc..0d7f46895 100644 --- a/app/views/organisations/show.html.erb +++ b/app/views/organisations/show.html.erb @@ -5,10 +5,17 @@ <% end %>
+ +
+ <%= render NavigationComponent.new( + items: secondary_items(request.path, @organisation.id), + level: "sub" + ) %> +
<%= govuk_summary_list do |summary_list| %> <% @organisation.display_attributes.each do |attr| %> - <% if can_edit_org?(current_user) && attr[:editable] %> + <% if can_edit_org?(current_user) && attr[:editable] || current_user.support? %> <%= summary_list.row do |row| %> <% row.key { attr[:name].to_s.humanize } %> <% row.value { details_html(attr) } %> diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 5779548e1..723550908 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -403,6 +403,25 @@ RSpec.describe OrganisationsController, type: :request do expect(page).to have_content("About this organisation") end end + + context "when viewing a specific organisation details" do + before do + get "/organisations/#{organisation.id}/details", headers:, params: {} + end + + it "displays the name of the organisation" do + expect(page).to have_content(organisation.name) + end + + it "has a sub-navigation with correct tabs" do + expect(page).to have_css(".app-sub-navigation") + expect(page).to have_content("About this organisation") + end + + it "allows to edit the organisation details" do + expect(page).to have_link("Change", count: 10) + end + end end context "when there are more than 20 organisations" do