diff --git a/app/views/organisations/logs.erb b/app/views/organisations/logs.erb index b845d8fe9..4bf8ed232 100644 --- a/app/views/organisations/logs.erb +++ b/app/views/organisations/logs.erb @@ -1 +1,20 @@ -<%= render partial: "case_logs/log_list", locals: { case_logs: @case_logs, title: "Logs", pagy: @pagy } %> \ No newline at end of file +<% content_for :title, "Logs" %> + +

+ <%= @organisation.name %> + <%= content_for(:title) %> +

+
+
+ <%= govuk_button_to "Create a new lettings log", case_logs_path %> + <%#= govuk_link_to "Upload logs", bulk_upload_case_logs_path %> +
+ + <%= render partial: "case_logs/log_filters" %> + <% if @case_logs.present? %> +
+ <%= render partial: "case_logs/log_list", locals: { case_logs: @case_logs, title: "Logs", pagy: @pagy } %> + <%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "logs" } %> +
+ <% end %> +
diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index c75338bc6..fb2cddde0 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -366,14 +366,19 @@ RSpec.describe OrganisationsController, type: :request do context "when viewing a specific organisation" do let(:number_of_org1_case_logs) { 2 } let(:number_of_org2_case_logs) { 4 } + before do FactoryBot.create_list(:case_log, number_of_org1_case_logs, owning_organisation_id: organisation.id, managing_organisation_id: organisation.id) FactoryBot.create_list(:case_log, number_of_org2_case_logs, owning_organisation_id: unauthorised_organisation.id, managing_organisation_id: unauthorised_organisation.id) - end - - it "only shows logs for that organisation" do + get "/organisations/#{organisation.id}/logs", headers:, params: {} + end + + it "displays the name of the organisation in the header" do + expect(CGI.unescape_html(response.body)).to match("#{organisation.name}") + end + it "only shows logs for that organisation" do expect(page).to have_content("#{number_of_org1_case_logs} total logs") organisation.case_logs.map(&:id).each do |case_log_id| expect(page).to have_link case_log_id.to_s, href: "/logs/#{case_log_id}"