Browse Source

Merge pull request #117 from communitiesuk/frontend-fixes

Frontend fixes
pull/114/head
Paul Robert Lloyd 3 years ago committed by GitHub
parent
commit
fb0f66d705
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/helpers/check_answers_helper.rb
  2. 4
      app/helpers/tasklist_helper.rb
  3. 2
      app/views/case_logs/_log_list.html.erb
  4. 2
      app/views/case_logs/edit.html.erb
  5. 4
      app/views/case_logs/index.html.erb
  6. 2
      app/views/devise/mailer/confirmation_instructions.html.erb
  7. 2
      app/views/devise/mailer/reset_password_instructions.html.erb
  8. 2
      app/views/devise/mailer/unlock_instructions.html.erb
  9. 5
      app/views/devise/passwords/new.html.erb
  10. 5
      app/views/devise/registrations/edit.html.erb
  11. 12
      app/views/devise/shared/_links.html.erb
  12. 2
      app/views/form/_check_answers_table.html.erb
  13. 5
      app/views/form/page.html.erb
  14. 66
      app/views/layouts/_footer.html.erb
  15. 49
      app/views/layouts/application.html.erb
  16. 2
      app/views/test/index.html.erb
  17. 2
      app/views/users/account/index.html.erb
  18. 5
      app/views/users/account/personal_details.html.erb
  19. 10
      config/forms/2021_2022.json
  20. 2
      config/locales/devise.en.yml
  21. 14
      docs/api/DLUHC-CORE-Data.v1.json
  22. 4
      public/404.html
  23. 2
      public/422.html
  24. 4
      spec/features/form/tasklist_page_spec.rb
  25. 4
      spec/fixtures/forms/test_validator.json
  26. 6
      spec/views/case_log_index_view_spec.rb

4
app/helpers/check_answers_helper.rb

@ -1,3 +1,5 @@
include GovukLinkHelper
module CheckAnswersHelper
def display_answered_questions_summary(subsection, case_log)
total = subsection.applicable_questions_count(case_log)
@ -15,6 +17,6 @@ private
def create_next_missing_question_link(subsection, case_log)
pages_to_fill_in = subsection.unanswered_questions(case_log).map(&:page)
url = "/case_logs/#{case_log.id}/#{pages_to_fill_in.first.id}"
link_to("Answer the missing questions", url, class: "govuk-link").html_safe
govuk_link_to("Answer the missing questions", url).html_safe
end
end

4
app/helpers/tasklist_helper.rb

@ -1,3 +1,5 @@
include GovukLinkHelper
module TasklistHelper
STATUSES = {
not_started: "Not started",
@ -38,6 +40,6 @@ module TasklistHelper
else
"#"
end
link_to(subsection.label, next_page_path, class: "task-name govuk-link")
govuk_link_to(subsection.label, next_page_path, class: "task-name")
end
end

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), class: "govuk-link" %>
<%= govuk_link_to log.id, case_log_path(log) %>
</th>
<td class="govuk-table__cell govuk-table__cell">
<%= log.property_postcode %>

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

@ -6,7 +6,7 @@
<h2 class="govuk-heading-s govuk-!-margin-bottom-2">This submission is
<%= @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">Youve 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).id %>
<a class="govuk-link" href="#<%= next_incomplete_section %>"

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

@ -4,14 +4,14 @@
</div>
<div class="govuk-grid-column-two-thirds-from-desktop">
<%= link_to "Create new log", case_logs_path, method: :post, class: "govuk-button" %>
<%= govuk_button_link_to "Create new log", case_logs_path, method: :post %>
<% 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" } %>
<%= render partial: "log_list", locals: { case_logs: @completed_case_logs, title: "Logs youve submitted", date_title: "Date Submitted" } %>
<% end %>
<p><a href="#" class="govuk-link">See all completed logs (<%= @completed_case_logs.count %>)</a></p>

2
app/views/devise/mailer/confirmation_instructions.html.erb

@ -2,4 +2,4 @@
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
<p><%= govuk_link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>

2
app/views/devise/mailer/reset_password_instructions.html.erb

@ -2,7 +2,7 @@
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p><%= govuk_link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

2
app/views/devise/mailer/unlock_instructions.html.erb

@ -4,4 +4,4 @@
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
<p><%= govuk_link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>

5
app/views/devise/passwords/new.html.erb

@ -1,5 +1,8 @@
<% content_for :before_content do %>
<%= link_to 'Back', :back, class: "govuk-back-link" %>
<%= govuk_back_link(
text: 'Back',
href: :back,
) %>
<% end %>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>

5
app/views/devise/registrations/edit.html.erb

@ -1,5 +1,8 @@
<% content_for :before_content do %>
<%= link_to 'Back', :back, class: "govuk-back-link" %>
<%= govuk_back_link(
text: 'Back',
href: :back,
) %>
<% end %>
<%= form_for(resource, as: resource_name, url: user_registration_path(), html: { method: :patch }) do |f| %>

12
app/views/devise/shared/_links.html.erb

@ -1,25 +1,25 @@
<%- if controller_name != 'sessions' %>
<p class="govuk-body">Already have an account? <%= link_to "Sign in", new_session_path(resource_name) %>.</p><br />
<p class="govuk-body">Already have an account? <%= govuk_link_to "Sign in", new_session_path(resource_name) %>.</p><br />
<% end %>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<%= govuk_link_to "Sign up", new_registration_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<p class="govuk-body"> You can <%= link_to "reset your password", new_password_path(resource_name) %> if you've forgotten it.<p><br />
<p class="govuk-body"> You can <%= govuk_link_to "reset your password", new_password_path(resource_name) %> if youve forgotten it.<p><br />
<% end %>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<%= govuk_link_to "Didn’t receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<%= govuk_link_to "Didn’t receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end %>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %><br />
<%= govuk_link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %><br />
<% end %>
<% end %>

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

@ -6,6 +6,6 @@
<%= question.answer_label(@case_log) %>
</dd>
<dd class="govuk-summary-list__actions">
<%= link_to(question.update_answer_link_name(@case_log), "/case_logs/#{@case_log.id}/#{question.page.id}", class: "govuk-link").html_safe %>
<%= govuk_link_to(question.update_answer_link_name(@case_log), "/case_logs/#{@case_log.id}/#{question.page.id}").html_safe %>
</dd>
</div>

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

@ -1,5 +1,8 @@
<% content_for :before_content do %>
<%= link_to 'Back', 'javascript:history.back()', class: "govuk-back-link" %>
<%= govuk_back_link(
text: 'Back',
href: 'javascript:history.back()',
) %>
<% end %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %>

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

@ -1,48 +1,28 @@
<div class="govuk-width-container ">
<div class="govuk-footer__meta">
<%= govuk_footer do |footer| %>
<%= footer.meta do %>
<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">dluhc.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>
<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 govuk-!-margin-bottom-0">
<li>
<a class="govuk-link govuk-footer__link" href="mailto:mhclg.digital-services@communities.gov.uk?subject=CORE">dluhc.digital-services@communities.gov.uk</a>
</li>
<li class="govuk-!-margin-bottom-0">We aim to respond within 2 working days</li>
</ul>
</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>
<% end %>
<% end %>

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

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" class="govuk-template ">
<html lang="en" class="govuk-template">
<head>
<title>DLUHC CORE Data Collection</title>
<%= csrf_meta_tags %>
@ -25,44 +25,39 @@
</head>
<body class="govuk-template__body ">
<script>
document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
</script>
<a href="#main-content" class="govuk-skip-link">Skip to main content</a>
<%= govuk_skip_link %>
<header class="govuk-header" role="banner" data-module="govuk-header">
<%= render GovukComponent::HeaderComponent.new(
logotype: 'GOV.UK',
service_name: 'Share Lettings and Sales for Social Housing in England Data with DLUHC',
service_url: '/'
) do |component|
if current_user.nil?
component.navigation_item(text: 'Case logs', href: '/case_logs')
elsif
component.navigation_item(text: 'Your account', href: '/users/account')
component.navigation_item(text: 'Sign out', href: destroy_user_session_path, options: {:method => :delete})
end
end
%>
</header>
<aside class="govuk-width-container">
<%= render GovukComponent::PhaseBannerComponent.new(
<%= govuk_header(
logotype: 'GOV.UK',
service_name: 'Share Lettings and Sales for Social Housing in England Data with DLUHC',
service_url: '/'
) do |component|
if current_user.nil?
component.navigation_item(text: 'Case logs', href: '/case_logs')
elsif
component.navigation_item(text: 'Your account', href: '/users/account')
component.navigation_item(text: 'Sign out', href: destroy_user_session_path, options: {:method => :delete})
end
end
%>
<div class="govuk-width-container">
<%= govuk_phase_banner(
tag: { text: 'Beta' },
text: "This is a new service – #{govuk_mail_to("test@mhclg.gov.uk", "give feedback or report a problem", subject: "Feedback about Lettings and Sales of Social Housing in England Data Collection")}".html_safe
) %>
</aside>
<div class="govuk-width-container">
<div role="navigation">
<%= content_for(:before_content) %>
</div>
<main class="govuk-main-wrapper " id="main-content" role="main">
<main class="govuk-main-wrapper" id="main-content" role="main">
<% flash.each do |type, msg| %>
<%= render GovukComponent::NotificationBannerComponent.new(
<%= govuk_notification_banner(
title_text: 'Success',
success: true, title_heading_level: 3,
title_id: "swanky-notifications") do |notification_banner|
@ -74,8 +69,6 @@
</main>
</div>
<footer class="govuk-footer">
<%= render partial: "layouts/footer" %>
</footer>
<%= render partial: "layouts/footer" %>
</body>
</html>

2
app/views/test/index.html.erb

@ -27,4 +27,4 @@
end
end %>
<%= link_to('About', about_path) %>
<%= govuk_link_to('About', about_path) %>

2
app/views/users/account/index.html.erb

@ -43,7 +43,7 @@
••••••••
</dd>
<dd class="govuk-summary-list__actions">
<%= link_to "Change", edit_user_registration_path, id: "change-password" %>
<%= govuk_link_to "Change", edit_user_registration_path, id: "change-password" %>
</dd>
</div>
<div class="govuk-summary-list__row">

5
app/views/users/account/personal_details.html.erb

@ -1,5 +1,8 @@
<% content_for :before_content do %>
<%= link_to 'Back', :back, class: "govuk-back-link" %>
<%= govuk_back_link(
text: 'Back',
href: :back,
) %>
<% end %>
<%= form_for(current_user, as: :user, url: account_update_path(), html: { method: :patch }) do |f| %>

10
config/forms/2021_2022.json

@ -822,11 +822,11 @@
"15": "Under occupation - no incentive",
"16": "Property unsuitable because of ill health / disability",
"17": "Property unsuitable because of poor condition",
"18": "Couldn't afford fees attached to renewing the tenancy",
"19": "Couldn't afford increase in rent",
"20": "Couldn't afford rent or mortgage - welfare reforms",
"21": "Couldn't afford rent or mortgage - employment",
"22": "Couldn't afford rent or mortgage - other",
"18": "Couldnt afford fees attached to renewing the tenancy",
"19": "Couldnt afford increase in rent",
"20": "Couldnt afford rent or mortgage - welfare reforms",
"21": "Couldnt afford rent or mortgage - employment",
"22": "Couldnt afford rent or mortgage - other",
"23": "To move nearer to family / friends / school",
"24": "To move nearer to work",
"25": "To move to accomodation with support",

2
config/locales/devise.en.yml

@ -31,7 +31,7 @@ en:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account."
passwords:
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
no_token: "You cant access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
updated: "Your password has been changed successfully. You are now signed in."

14
docs/api/DLUHC-CORE-Data.v1.json

@ -740,19 +740,19 @@
"Other problems with neighbours",
"Property unsuitable because of overcrowding",
"End of assured shorthold tenancy - no fault",
"End of assured shorthold tenancy - tenant's fault",
"End of assured shorthold tenancy - tenants fault",
"End of fixed term tenancy - no fault",
"End of fixed term tenancy - tenant's fault",
"End of fixed term tenancy - tenants fault",
"Repossession",
"Under occupation - offered incentive to downsize",
"Under occupation - no incentive",
"Property unsuitable because of ill health / disability",
"Property unsuitable because of poor condition",
"Couldn't afford fees attached to renewing the tenancy",
"Couldn't afford increase in rent",
"Couldn't afford rent or mortgage - welfare reforms",
"Couldn't afford rent or mortgage - employment",
"Couldn't afford rent or mortgage - other",
"Couldnt afford fees attached to renewing the tenancy",
"Couldnt afford increase in rent",
"Couldnt afford rent or mortgage - welfare reforms",
"Couldnt afford rent or mortgage - employment",
"Couldnt afford rent or mortgage - other",
"To move nearer to family / friends / school",
"To move nearer to work",
"To move to accomodation with support",

4
public/404.html

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<title>The page you were looking for doesnt exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.rails-default-error-page {
@ -58,7 +58,7 @@
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h1>The page you were looking for doesn't exist.</h1>
<h1>The page you were looking for doesnt exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>

2
public/422.html

@ -59,7 +59,7 @@
<div class="dialog">
<div>
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
<p>Maybe you tried to change something you didnt have access to.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>

4
spec/features/form/tasklist_page_spec.rb

@ -42,12 +42,12 @@ RSpec.describe "Task List" do
it "shows the number of completed sections if no sections are completed" do
visit("/case_logs/#{empty_case_log.id}")
expect(page).to have_content("You've completed 0 of 9 sections.")
expect(page).to have_content("Youve completed 0 of 9 sections.")
end
it "shows the number of completed sections if one section is completed" do
answer_all_questions_in_income_subsection(empty_case_log)
visit("/case_logs/#{empty_case_log.id}")
expect(page).to have_content("You've completed 1 of 9 sections.")
expect(page).to have_content("Youve completed 1 of 9 sections.")
end
end

4
spec/fixtures/forms/test_validator.json vendored

@ -8,12 +8,12 @@
"subsections": {
"household_characteristics": {
"label": "Household characteristics",
"ShouldThrowError": "Shouldn't be here but what you gonna do?",
"ShouldThrowError": "Shouldnt be here but what you gonna do?",
"pages": {
"tenant_code": {
"header": "",
"description": "",
"ShouldThrowError": "Shouldn't be here but what you gonna do?",
"ShouldThrowError": "Shouldnt be here but what you gonna do?",
"questions": {
"tenant_code": {
"check_answer_label": "Tenant code",

6
spec/views/case_log_index_view_spec.rb

@ -10,7 +10,7 @@ RSpec.describe "case_logs/index" do
render
expect(rendered).to match(/<table class="govuk-table">/)
expect(rendered).to match(/Logs you need to complete/)
expect(rendered).not_to match(/Logs you&#39;ve submitted/)
expect(rendered).not_to match(/Logs youve submitted/)
expect(rendered).to match(in_progress_log.tenant_code)
expect(rendered).to match(in_progress_log.property_postcode)
end
@ -22,7 +22,7 @@ RSpec.describe "case_logs/index" do
assign(:completed_case_logs, [completed_log])
render
expect(rendered).to match(/<table class="govuk-table">/)
expect(rendered).to match(/Logs you&#39;ve submitted/)
expect(rendered).to match(/Logs youve 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)
@ -35,7 +35,7 @@ RSpec.describe "case_logs/index" do
assign(:completed_case_logs, [completed_log])
render
expect(rendered).to match(/<table class="govuk-table">/)
expect(rendered).to match(/Logs you&#39;ve submitted/)
expect(rendered).to match(/Logs youve submitted/)
expect(rendered).to match(/Logs you need to complete/)
end
end

Loading…
Cancel
Save