magicmilo 3 years ago
parent
commit
54ac2e5511
  1. 2
      app/controllers/case_logs_controller.rb
  2. 2
      app/helpers/check_answers_helper.rb
  3. 2
      app/javascript/controllers/soft_validations_controller.js
  4. 2
      app/views/case_logs/edit.html.erb
  5. 2
      app/views/form/check_answers.html.erb
  6. 5
      app/views/form/page.html.erb
  7. 48
      app/views/layouts/_footer.html.erb
  8. 29
      app/views/layouts/application.html.erb
  9. 2
      spec/features/case_log_spec.rb

2
app/controllers/case_logs_controller.rb

@ -107,6 +107,8 @@ private
day = params["case_log"]["#{question_key}(3i)"]
month = params["case_log"]["#{question_key}(2i)"]
year = params["case_log"]["#{question_key}(1i)"]
next unless day.present? && month.present? && year.present?
result[question_key] = Date.new(year.to_i, month.to_i, day.to_i)
end
next unless question_params

2
app/helpers/check_answers_helper.rb

@ -60,6 +60,8 @@ module CheckAnswersHelper
case_log[question_key].blank? || !condition.include?(case_log[question_key])
when "radio"
case_log[question_key].blank? || !condition.include?(case_log[question_key])
when "select"
case_log[question_key].blank? || !condition.include?(case_log[question_key])
else
raise "Not implemented yet"
end

2
app/javascript/controllers/soft_validations_controller.js

@ -5,7 +5,7 @@ export default class extends Controller {
initialize() {
let url = window.location.href + "/soft_validations"
this.fetch_retry(url, { headers: { accept: "application/json" } }, 2)
this.fetch_retry(url, { headers: { accept: "application/json" } }, 5)
}
fetch_retry(url, options, n) {

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

@ -5,7 +5,7 @@
<%= @case_log.id %></h1>
<h2 class="govuk-heading-s govuk-!-margin-bottom-2">This submission is
<%= @case_log.status %></h2>
<%= @case_log.status.to_s.humanize %></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) %>

2
app/views/form/check_answers.html.erb

@ -10,7 +10,7 @@
<%end %>
<%end %>
<% end %>
<%= form_with action: '/case_logs', method: "next_page", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= form_with model: @case_log, method: "get", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_submit "Save and continue" %>
<% end %>
</div>

5
app/views/form/page.html.erb

@ -3,7 +3,8 @@
<% end %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<% if page_info["header"].present? %>
<h1 class="govuk-heading-xl">
<%= page_info["header"] %>
@ -24,4 +25,6 @@
<%= f.hidden_field :page, value: page_key %>
<%= f.govuk_submit "Save and continue" %>
<% end %>
</div>
</div>
<% end %>

48
app/views/layouts/_footer.html.erb

@ -0,0 +1,48 @@
<div class="govuk-width-container ">
<div class="govuk-footer__meta">
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
<h2 class="govuk-visually-hidden">Support links</h2>
<div class="govuk-footer__meta-custom">
<h2 class="govuk-heading-m">Get help with this service</h2>
<h3 class="govuk-heading-s govuk-!-margin-bottom-1">Online helpdesk</h3>
<p class="govuk-body govuk-!-font-size-16">
<a class="govuk-link govuk-footer__link" href="https://digital.dclg.gov.uk/jira/servicedesk/customer/portal/4/group/21" target="_blank">CORE helpdesk</a>
(opens in a new tab)</p>
<h3 class="govuk-heading-s govuk-!-margin-bottom-1">Telephone</h3>
<ul class="govuk-list govuk-!-font-size-16">
<li>Telephone: 0333 202 5084</li>
<li>Monday to Friday, 9am to 5:30pm (except public holidays)</li>
</ul>
<h3 class="govuk-heading-s govuk-!-margin-bottom-1">Email</h3>
<ul class="govuk-list govuk-!-font-size-16">
<li>
<a class="govuk-link govuk-footer__link" href="mailto:mhclg.digital-services@communities.gov.uk?subject=CORE">mhclg.digital-services@communities.gov.uk</a>
</li>
<li>We aim to respond within 2 working days</li>
</ul>
<h2 class="govuk-visually-hidden">Footer links</h2>
</div>
<svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 483.2 195.7" height="17" width="41">
<path
fill="currentColor"
d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"/>
</svg>
<span class="govuk-footer__licence-description">
All content is available under the
<a class="govuk-footer__link" href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence v3.0</a>, except where otherwise stated
</span>
</div>
<div class="govuk-footer__meta-item">
<a class="govuk-footer__link govuk-footer__copyright-logo" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">© Crown copyright</a>
</div>
</div>
</div>

29
app/views/layouts/application.html.erb

@ -72,34 +72,7 @@
</div>
<footer class="govuk-footer">
<div class="govuk-width-container ">
<div class="govuk-footer__meta">
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
<h2 class="govuk-visually-hidden">Support links</h2>
<div class="govuk-footer__meta-custom">
<h2 class="govuk-heading-m">Support and guidance</h2>
<p class="govuk-body-s">
If you have a question, or you've had a problem using this service, please contact us at <%= mail_to "test@mhclg.gov.uk", "test@mhclg.gov.uk", class: "govuk-footer__link" %>
</p>
</div>
<svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
<path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145" />
</svg>
<span class="govuk-footer__licence-description">
All content is available under the
<a class="govuk-footer__link" href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence v3.0</a>, except where otherwise stated
</span>
</div>
<div class="govuk-footer__meta-item">
<a class="govuk-footer__link govuk-footer__copyright-logo" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">© Crown copyright</a>
</div>
</div>
</div>
<%= render partial: "layouts/footer" %>
</footer>
</body>
</html>

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}")
expect(page).to have_content("This submission is #{status.humanize}")
end
it "displays a section status" do

Loading…
Cancel
Save