From 6c4bb79b6a0ac6bc3f1320ac0088581d96051ccd Mon Sep 17 00:00:00 2001 From: Daniel Baark <5101747+baarkerlounger@users.noreply.github.com> Date: Mon, 15 Nov 2021 14:09:44 +0000 Subject: [PATCH 1/2] Bug fixes (#90) * Use the correct blue * Use SASS for hover * Use govuk frontend classes * Don't add new stylesheet --- app/javascript/styles/_task-list.scss | 5 ----- app/javascript/styles/application.scss | 9 ++++++++- app/models/case_log.rb | 4 ++-- app/views/case_logs/_log_list.html.erb | 2 +- app/views/case_logs/edit.html.erb | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/javascript/styles/_task-list.scss b/app/javascript/styles/_task-list.scss index 755836e3f..603a6d55c 100644 --- a/app/javascript/styles/_task-list.scss +++ b/app/javascript/styles/_task-list.scss @@ -81,11 +81,6 @@ } } -// turbo-frame { -// display: block; -// border: 1px solid blue -// } - .app-task-list__item:target, .tasklist_item_highlight{ background-color: $govuk-focus-colour; diff --git a/app/javascript/styles/application.scss b/app/javascript/styles/application.scss index 4caf03bda..7e1158bd7 100644 --- a/app/javascript/styles/application.scss +++ b/app/javascript/styles/application.scss @@ -11,4 +11,11 @@ $govuk-image-url-function: frontend-image-url; @import "~govuk-frontend/govuk/all"; -@import '_task-list' +@import '_task-list'; + +$govuk-global-styles: true; + +// turbo-frame { +// display: block; +// border: 1px solid blue +// } diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 1842dc55a..5553b5a78 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -10,7 +10,7 @@ class CaseLogValidator < ActiveModel::Validator # If we've come from the form UI we only want to validate the specific fields # that have just been submitted. If we're submitting a log via API or Bulk Upload # we want to validate all data fields. - page_to_validate = options[:page] + page_to_validate = record.page if page_to_validate public_send("validate_#{page_to_validate}", record) if respond_to?("validate_#{page_to_validate}") else @@ -41,7 +41,7 @@ class CaseLog < ApplicationRecord default_scope -> { kept } scope :not_completed, -> { where.not(status: "completed") } - validates_with CaseLogValidator, ({ page: @page } || {}) + validates_with CaseLogValidator before_save :update_status! attr_accessor :page diff --git a/app/views/case_logs/_log_list.html.erb b/app/views/case_logs/_log_list.html.erb index 3edfabe06..c0f856f09 100644 --- a/app/views/case_logs/_log_list.html.erb +++ b/app/views/case_logs/_log_list.html.erb @@ -12,7 +12,7 @@ <% case_logs.map do |log| %> - <%= link_to log.id, case_log_path(log) %> + <%= link_to log.id, case_log_path(log), class: "govuk-link" %> <%= log.property_postcode %> diff --git a/app/views/case_logs/edit.html.erb b/app/views/case_logs/edit.html.erb index 83d442cb9..349cc6914 100644 --- a/app/views/case_logs/edit.html.erb +++ b/app/views/case_logs/edit.html.erb @@ -9,7 +9,7 @@

You've completed <%= get_subsections_count(@form, @case_log, :completed) %> of <%= get_subsections_count(@form, @case_log, :all) %> sections.

<% next_incomplete_section=get_next_incomplete_section(@form, @case_log) %> - > From 06ac7b8c35a07f62b9dac0a2afd2b2b610593d97 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Mon, 15 Nov 2021 14:23:55 +0000 Subject: [PATCH 2/2] Downcase case log status in tasklist --- app/views/case_logs/edit.html.erb | 2 +- spec/features/case_log_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/case_logs/edit.html.erb b/app/views/case_logs/edit.html.erb index 349cc6914..25668b2ac 100644 --- a/app/views/case_logs/edit.html.erb +++ b/app/views/case_logs/edit.html.erb @@ -5,7 +5,7 @@ <%= @case_log.id %>

This submission is - <%= @case_log.status.to_s.humanize %>

+ <%= @case_log.status.to_s.humanize.downcase %>

You've completed <%= get_subsections_count(@form, @case_log, :completed) %> of <%= get_subsections_count(@form, @case_log, :all) %> sections.

<% next_incomplete_section=get_next_incomplete_section(@form, @case_log) %> diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index 5552b0c85..a616b7baf 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -43,7 +43,7 @@ RSpec.describe "Test Features" do it "displays a tasklist header" do visit("/case_logs/#{id}") expect(page).to have_content("Tasklist for log #{id}") - expect(page).to have_content("This submission is #{status.humanize}") + expect(page).to have_content("This submission is #{status.humanize.downcase}") end it "displays a section status" do