Browse Source

Merge branch 'main' into CLDC-687ImplementPropertyInformation

pull/95/head
magicmilo 3 years ago
parent
commit
aaa3c56e5d
  1. 5
      app/javascript/styles/_task-list.scss
  2. 9
      app/javascript/styles/application.scss
  3. 4
      app/models/case_log.rb
  4. 2
      app/views/case_logs/_log_list.html.erb
  5. 4
      app/views/case_logs/edit.html.erb
  6. 2
      spec/features/case_log_spec.rb

5
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;

9
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
// }

4
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

2
app/views/case_logs/_log_list.html.erb

@ -12,7 +12,7 @@
<% case_logs.map do |log| %>
<tr class="govuk-table__row">
<th scope="row" class="govuk-table__header">
<%= link_to log.id, case_log_path(log) %>
<%= link_to log.id, case_log_path(log), class: "govuk-link" %>
</th>
<td class="govuk-table__cell govuk-table__cell">
<%= log.property_postcode %>

4
app/views/case_logs/edit.html.erb

@ -5,11 +5,11 @@
<%= @case_log.id %></h1>
<h2 class="govuk-heading-s govuk-!-margin-bottom-2">This submission is
<%= @case_log.status.to_s.humanize %></h2>
<%= @case_log.status.to_s.humanize.downcase %></h2>
<p class="govuk-body govuk-!-margin-bottom-7">You've completed <%= get_subsections_count(@form, @case_log, :completed) %> of <%= get_subsections_count(@form, @case_log, :all) %> sections.</p>
<p class="govuk-body govuk-!-margin-bottom-7">
<% next_incomplete_section=get_next_incomplete_section(@form, @case_log) %>
<a href="#<%= next_incomplete_section %>"
<a class="govuk-link" href="#<%= next_incomplete_section %>"
data-controller="tasklist"
data-action="tasklist#addHighlight"
data-info=<%= next_incomplete_section %>>

2
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

Loading…
Cancel
Save