From 461eb0fe42b3d7184e772e38c4bcf2bd2a54282a Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Thu, 3 Mar 2022 16:26:43 +0000 Subject: [PATCH 1/3] =?UTF-8?q?Remove=20=E2=80=98your=E2=80=99=20when=20me?= =?UTF-8?q?ntioning=20logs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/case_logs/index.html.erb | 2 +- app/views/layouts/application.html.erb | 2 +- config/forms/2021_2022.json | 4 ++-- spec/features/start_page_spec.rb | 4 ++-- spec/fixtures/forms/2021_2022.json | 2 +- spec/fixtures/forms/2022_2023.json | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/case_logs/index.html.erb b/app/views/case_logs/index.html.erb index 2b4e2d815..7406cd1e4 100644 --- a/app/views/case_logs/index.html.erb +++ b/app/views/case_logs/index.html.erb @@ -1,4 +1,4 @@ -<% content_for :title, "Your logs" %> +<% content_for :title, "Logs" %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 569d73e9e..3afed8b18 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -43,7 +43,7 @@ if current_user.nil? component.navigation_item(text: 'Sign in', href: user_session_path) elsif - component.navigation_item(text: 'Your logs', href: case_logs_path) + component.navigation_item(text: 'Logs', href: case_logs_path) component.navigation_item(text: 'Your organisation', href: "/organisations/#{current_user.organisation.id}") component.navigation_item(text: 'Your account', href: user_path(current_user)) component.navigation_item(text: 'Sign out', href: destroy_user_session_path, options: { data: {turbo_method: :delete}, method: :delete }) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 60630894a..c275d7ff2 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -7,7 +7,7 @@ "label": "Before you start", "subsections": { "setup": { - "label": "Set up your lettings log", + "label": "Set up this lettings log", "pages": { "organisation_details": { "header": "Organisation details", @@ -5640,7 +5640,7 @@ "questions": { "declaration": { "check_answer_label": "", - "header": "Submit your lettings log ", + "header": "Submit this lettings log ", "hint_text": "", "type": "checkbox", "answer_options": { diff --git a/spec/features/start_page_spec.rb b/spec/features/start_page_spec.rb index 6694cf251..d703a8439 100644 --- a/spec/features/start_page_spec.rb +++ b/spec/features/start_page_spec.rb @@ -10,14 +10,14 @@ RSpec.describe "Start Page Features" do sign_in user end - it "takes you to your logs" do + it "takes you to logs" do visit("/") expect(page).to have_current_path("/logs") end end context "when the user is not signed in" do - it "takes you to sign in and then to your logs" do + it "takes you to sign in and then to logs" do visit("/") click_link("Start now") expect(page).to have_current_path("/users/sign-in?start=true") diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index f865c75ac..5b3bbb7f9 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -814,7 +814,7 @@ "questions": { "declaration": { "check_answer_label": "", - "header": "Submit your lettings log ", + "header": "Submit this lettings log ", "type": "checkbox", "answer_options": { "declaration": { diff --git a/spec/fixtures/forms/2022_2023.json b/spec/fixtures/forms/2022_2023.json index c56b216f3..8d856aa1c 100644 --- a/spec/fixtures/forms/2022_2023.json +++ b/spec/fixtures/forms/2022_2023.json @@ -7,7 +7,7 @@ "label": "Before you start", "subsections": { "setup": { - "label": "Set up your lettings log", + "label": "Set up this lettings log", "pages": { "renewal": { "header": "", From 7e7b7b0d9e23a3f2f0f397ef78d887ad37e3cea2 Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Thu, 3 Mar 2022 18:06:10 +0000 Subject: [PATCH 2/3] Widen layout --- app/views/layouts/application.html.erb | 2 +- app/webpacker/styles/_template.scss | 5 +++++ app/webpacker/styles/application.scss | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 app/webpacker/styles/_template.scss diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3afed8b18..c52d89a58 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -28,7 +28,7 @@ <% end %> - + diff --git a/app/webpacker/styles/_template.scss b/app/webpacker/styles/_template.scss new file mode 100644 index 000000000..32bb6309e --- /dev/null +++ b/app/webpacker/styles/_template.scss @@ -0,0 +1,5 @@ +.app-template--wide { + .govuk-width-container { + @include govuk-width-container(1100px); + } +} diff --git a/app/webpacker/styles/application.scss b/app/webpacker/styles/application.scss index e9d79b7bf..5c55f4889 100644 --- a/app/webpacker/styles/application.scss +++ b/app/webpacker/styles/application.scss @@ -16,8 +16,9 @@ $govuk-global-styles: true; @import "input"; @import "related-navigation"; @import "section-skip-link"; -@import "task-list"; @import "tab-navigation"; +@import "task-list"; +@import "template"; // Overrides .app-\!-colour-muted { From ffcd0ed0d9de0a14ff1ab735b740018e04d633fe Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Thu, 3 Mar 2022 18:49:23 +0000 Subject: [PATCH 3/3] Update logs summary page --- app/controllers/case_logs_controller.rb | 3 +- app/views/case_logs/_log_list.html.erb | 75 +++++++++++++--------- app/views/case_logs/index.html.erb | 27 +++----- app/webpacker/styles/_figure.scss | 10 +++ app/webpacker/styles/_table-group.scss | 44 +++++++++++++ app/webpacker/styles/application.scss | 17 ++++- spec/features/form/form_navigation_spec.rb | 4 +- spec/views/case_log_index_view_spec.rb | 45 ++----------- 8 files changed, 135 insertions(+), 90 deletions(-) create mode 100644 app/webpacker/styles/_figure.scss create mode 100644 app/webpacker/styles/_table-group.scss diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 8d6f75c5c..1b016473c 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -5,8 +5,7 @@ class CaseLogsController < ApplicationController before_action :find_resource, except: %i[create index edit] def index - @completed_case_logs = current_user.completed_case_logs - @in_progress_case_logs = current_user.not_completed_case_logs + @case_logs = current_user.case_logs end def create diff --git a/app/views/case_logs/_log_list.html.erb b/app/views/case_logs/_log_list.html.erb index a509a68e5..ab9fe9a0a 100644 --- a/app/views/case_logs/_log_list.html.erb +++ b/app/views/case_logs/_log_list.html.erb @@ -1,29 +1,46 @@ - - - - - - - - - - - - <% case_logs.map do |log| %> - - - - - - - <% end %> - -
<%= title %>
Log referencePostcodeTenant code<%= date_title %>
- <%= govuk_link_to log.id, case_log_path(log) %> - - <%= log.property_postcode %> - - <%= log.tenant_code %> - - <%= log.updated_at.to_formatted_s(:govuk_date) %> -
+
+
+ <%= case_logs.count %> <%= title.downcase %> +
+
+ + + + + + + + + + + + + <% case_logs.map do |log| %> + + + + + + + + + <% end %> + +
LogTenantPropertyTenacy startsLog createdCompleted
+ <%= govuk_link_to log.id, case_log_path(log) %> + + <%= log.tenant_code? ? log.tenant_code : '–' %> + + <%= log.propcode? ? log.propcode : '–' %> + + <%= log.startdate.present? ? log.startdate.to_formatted_s(:govuk_date) : '–' %> + + <%= log.created_at.to_formatted_s(:govuk_date) %> + + <%= govuk_tag( + colour: log.status == 'completed' ? 'blue' : 'grey', + text: log.status.humanize + ) %> +
+
+
diff --git a/app/views/case_logs/index.html.erb b/app/views/case_logs/index.html.erb index 7406cd1e4..02c7851ee 100644 --- a/app/views/case_logs/index.html.erb +++ b/app/views/case_logs/index.html.erb @@ -1,21 +1,14 @@ <% content_for :title, "Logs" %> -
-
-

- <%= content_for(:title) %> -

+

+ <%= content_for(:title) %> +

- <%= govuk_button_to "Create new log", case_logs_path %> - - <% if @in_progress_case_logs.present? %> - <%= render partial: "log_list", locals: { case_logs: @in_progress_case_logs, title: "Logs you need to complete", date_title: "Last Changed" } %> - <% end %> - - <% if @completed_case_logs.present? %> - <%= render partial: "log_list", locals: { case_logs: @completed_case_logs, title: "Logs you’ve submitted", date_title: "Date Submitted" } %> - <% end %> - -

See all completed logs (<%= @completed_case_logs.count %>)

-
+
+ <%= govuk_button_to "Create a new lettings log", case_logs_path %> + <%= govuk_link_to "Upload logs", bulk_upload_case_logs_path %>
+ +<% if @case_logs.present? %> + <%= render partial: "log_list", locals: { case_logs: @case_logs, title: "Logs" } %> +<% end %> diff --git a/app/webpacker/styles/_figure.scss b/app/webpacker/styles/_figure.scss new file mode 100644 index 000000000..f1a895dfd --- /dev/null +++ b/app/webpacker/styles/_figure.scss @@ -0,0 +1,10 @@ +.app-figure { + margin: 0; +} + +.app-figure__caption { + @include govuk-font($size: 19); + border-top: 1px solid $govuk-border-colour; + margin-bottom: govuk-spacing(6); + padding-top: govuk-spacing(4); +} diff --git a/app/webpacker/styles/_table-group.scss b/app/webpacker/styles/_table-group.scss new file mode 100644 index 000000000..71905dfec --- /dev/null +++ b/app/webpacker/styles/_table-group.scss @@ -0,0 +1,44 @@ +.app-table-group { + overflow-x: auto; + overflow-y: hidden; + margin: govuk-spacing(-3) govuk-spacing(-3) govuk-spacing(3); + padding: 0 govuk-spacing(3); + scrollbar-color: $govuk-text-colour govuk-colour("light-grey"); + + .govuk-table { + margin-bottom: -1px; + } + + .govuk-table__header, + .govuk-table__cell { + white-space: nowrap; + } + + &::-webkit-scrollbar { + height: govuk-spacing(1); + width: govuk-spacing(1); + } + + &::-webkit-scrollbar-thumb { + background: $govuk-text-colour; + } + + &::-webkit-scrollbar-track { + background: govuk-colour("light-grey"); + } +} + +.app-table-group:focus { + box-shadow: 0 0 0 #{$govuk-focus-width * 2} $govuk-focus-colour; + outline: $govuk-focus-width solid govuk-colour("black"); +} + +.app-table-group:focus:not(:focus-visible) { + box-shadow: none; + outline: none; +} + +.app-table-group:focus-visible { + box-shadow: 0 0 0 #{$govuk-focus-width * 2} $govuk-focus-colour; + outline: $govuk-focus-width solid govuk-colour("black"); +} diff --git a/app/webpacker/styles/application.scss b/app/webpacker/styles/application.scss index 5c55f4889..6d5924b28 100644 --- a/app/webpacker/styles/application.scss +++ b/app/webpacker/styles/application.scss @@ -13,14 +13,29 @@ $govuk-global-styles: true; @import "~govuk-frontend/govuk/all"; @import "accessible-autocomplete"; +@import "figure"; @import "input"; @import "related-navigation"; @import "section-skip-link"; @import "tab-navigation"; +@import "table-group"; @import "task-list"; @import "template"; -// Overrides +// App utilities .app-\!-colour-muted { color: $govuk-secondary-text-colour !important; } + +.app-\!-font-tabular { + @include govuk-font($size: false, $tabular: true); +} + +// Overrides +.govuk-button-group { + align-items: center; +} + +.govuk-tag { + white-space: nowrap; +} diff --git a/spec/features/form/form_navigation_spec.rb b/spec/features/form/form_navigation_spec.rb index 93da01b0f..fa7a0f5cf 100644 --- a/spec/features/form/form_navigation_spec.rb +++ b/spec/features/form/form_navigation_spec.rb @@ -26,10 +26,10 @@ RSpec.describe "Form Navigation" do sign_in user end - describe "Create new log" do + describe "Create a new lettings log" do it "redirects to the task list for the new log" do visit("/logs") - click_button("Create new log") + click_button("Create a new lettings log") id = CaseLog.order(created_at: :desc).first.id expect(page).to have_content("Log #{id}") end diff --git a/spec/views/case_log_index_view_spec.rb b/spec/views/case_log_index_view_spec.rb index 947004a37..d7bcadc18 100644 --- a/spec/views/case_log_index_view_spec.rb +++ b/spec/views/case_log_index_view_spec.rb @@ -2,51 +2,18 @@ require "rails_helper" RSpec.describe "case_logs/index" do let(:in_progress_log) { FactoryBot.create(:case_log, :in_progress) } - let(:completed_log) { FactoryBot.create(:case_log, :completed) } - context "with an in progress log list" do + context "with a log list" do before do - assign(:in_progress_case_logs, [in_progress_log]) - assign(:completed_case_logs, []) + assign(:case_logs, [in_progress_log]) render end - it "renders a table for in progress logs only" do + it "renders a table for all logs" do expect(rendered).to match(//) - expect(rendered).to match(/Logs you need to complete/) - expect(rendered).not_to match(/Logs you’ve submitted/) - expect(rendered).to match(in_progress_log.tenant_code) - expect(rendered).to match(in_progress_log.property_postcode) - end - end - - context "with a completed log list" do - before do - assign(:in_progress_case_logs, []) - assign(:completed_case_logs, [completed_log]) - render - end - - it "renders a table for in progress logs only" do - expect(rendered).to match(/
/) - expect(rendered).to match(/Logs you’ve submitted/) - expect(rendered).not_to match(/Logs you need to complete/) - expect(rendered).to match(completed_log.tenant_code) - expect(rendered).to match(completed_log.property_postcode) - end - end - - context "with a completed log list and an in_progress log list" do - before do - assign(:in_progress_case_logs, [in_progress_log]) - assign(:completed_case_logs, [completed_log]) - render - end - - it "renders two tables, one for each status" do - expect(rendered).to match(/
/) - expect(rendered).to match(/Logs you’ve submitted/) - expect(rendered).to match(/Logs you need to complete/) + expect(rendered).to match(/logs/) + expect(rendered).to match(in_progress_log.created_at.to_formatted_s(:govuk_date)) + expect(rendered).to match(in_progress_log.status.humanize) end end end