Browse Source

Merge pull request #482 from communitiesuk/erb-lint

Add ERB Lint
pull/485/head
Paul Robert Lloyd 3 years ago committed by GitHub
parent
commit
b4692a883f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      .erb-lint.yml
  2. 1
      Gemfile
  3. 19
      Gemfile.lock
  4. 4
      app/components/tab_navigation_component.html.erb
  5. 11
      app/views/case_logs/_log_list.html.erb
  6. 3
      app/views/case_logs/bulk_upload.html.erb
  7. 2
      app/views/case_logs/edit.html.erb
  8. 3
      app/views/case_logs/index.html.erb
  9. 3
      app/views/devise/confirmations/new.html.erb
  10. 8
      app/views/devise/passwords/edit.html.erb
  11. 5
      app/views/devise/passwords/new.html.erb
  12. 8
      app/views/devise/passwords/reset_password.html.erb
  13. 6
      app/views/devise/sessions/new.html.erb
  14. 12
      app/views/devise/shared/_links.html.erb
  15. 4
      app/views/devise/two_factor_authentication/resend.html.erb
  16. 5
      app/views/devise/two_factor_authentication/show.html.erb
  17. 3
      app/views/devise/unlocks/new.html.erb
  18. 2
      app/views/filters/_checkbox_filter.html.erb
  19. 6
      app/views/form/_check_answers_table.html.erb
  20. 7
      app/views/form/_checkbox_question.html.erb
  21. 3
      app/views/form/_date_question.html.erb
  22. 11
      app/views/form/_interruption_screen_question.html.erb
  23. 6
      app/views/form/_numeric_question.html.erb
  24. 19
      app/views/form/_radio_question.html.erb
  25. 9
      app/views/form/_select_question.html.erb
  26. 5
      app/views/form/_text_question.html.erb
  27. 5
      app/views/form/_textarea_question.html.erb
  28. 12
      app/views/form/check_answers.html.erb
  29. 2
      app/views/form/guidance/_what_counts_as_income.html.erb
  30. 14
      app/views/form/page.html.erb
  31. 13
      app/views/layouts/_collection_resources.html.erb
  32. 61
      app/views/layouts/application.html.erb
  33. 2
      app/views/layouts/mailer.html.erb
  34. 2
      app/views/layouts/organisations.html.erb
  35. 17
      app/views/organisations/edit.html.erb
  36. 24
      app/views/organisations/show.html.erb
  37. 20
      app/views/organisations/users.html.erb
  38. 6
      app/views/pagy/_nav.html.erb
  39. 6
      app/views/start/index.html.erb
  40. 23
      app/views/users/edit.html.erb
  41. 24
      app/views/users/new.html.erb
  42. 40
      app/views/users/show.html.erb
  43. 8
      spec/features/reset_password.html.erb

24
.erb-lint.yml

@ -0,0 +1,24 @@
---
EnableDefaultLinters: true
linters:
Rubocop:
enabled: true
rubocop_config:
inherit_from:
- .rubocop.yml
Layout/ArgumentAlignment:
Enabled: false
Layout/CommentIndentation:
Enabled: false
Layout/FirstArgumentIndentation:
Enabled: false
Layout/FirstArrayElementIndentation:
Enabled: false
Layout/FirstHashElementIndentation:
Enabled: false
Layout/InitialIndentation:
Enabled: false
Layout/TrailingEmptyLines:
Enabled: false
Lint/UselessAssignment:
Enabled: false

1
Gemfile

@ -78,6 +78,7 @@ group :development do
gem "web-console", ">= 4.1.0" gem "web-console", ">= 4.1.0"
# Display performance information such as SQL time and flame graphs for each request in your browser. # Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
gem "erb_lint", require: false
gem "rack-mini-profiler", "~> 2.0" gem "rack-mini-profiler", "~> 2.0"
gem "rubocop-govuk", require: false gem "rubocop-govuk", require: false
gem "rubocop-performance", require: false gem "rubocop-performance", require: false

19
Gemfile.lock

@ -121,6 +121,14 @@ GEM
aws-sigv4 (1.4.0) aws-sigv4 (1.4.0)
aws-eventstream (~> 1, >= 1.0.2) aws-eventstream (~> 1, >= 1.0.2)
bcrypt (3.1.17) bcrypt (3.1.17)
better_html (1.0.16)
actionview (>= 4.0)
activesupport (>= 4.0)
ast (~> 2.0)
erubi (~> 1.4)
html_tokenizer (~> 0.0.6)
parser (>= 2.4)
smart_properties
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.11.1) bootsnap (1.11.1)
msgpack (~> 1.2) msgpack (~> 1.2)
@ -159,6 +167,14 @@ GEM
dotenv (= 2.7.6) dotenv (= 2.7.6)
railties (>= 3.2) railties (>= 3.2)
encryptor (3.0.0) encryptor (3.0.0)
erb_lint (0.1.1)
activesupport
better_html (~> 1.0.7)
html_tokenizer
parser (>= 2.7.1.4)
rainbow
rubocop
smart_properties
erubi (1.10.0) erubi (1.10.0)
excon (0.92.2) excon (0.92.2)
factory_bot (6.2.1) factory_bot (6.2.1)
@ -188,6 +204,7 @@ GEM
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
hashdiff (1.0.1) hashdiff (1.0.1)
html_tokenizer (0.0.7)
i18n (1.10.0) i18n (1.10.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
inherited_resources (1.13.1) inherited_resources (1.13.1)
@ -420,6 +437,7 @@ GEM
simplecov_json_formatter (~> 0.1) simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3) simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4) simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
stimulus-rails (1.0.4) stimulus-rails (1.0.4)
railties (>= 6.0.0) railties (>= 6.0.0)
strscan (3.0.1) strscan (3.0.1)
@ -469,6 +487,7 @@ DEPENDENCIES
chartkick chartkick
devise! devise!
dotenv-rails dotenv-rails
erb_lint
factory_bot_rails factory_bot_rails
govuk-components govuk-components
govuk_design_system_formbuilder govuk_design_system_formbuilder

4
app/components/tab_navigation_component.html.erb

@ -3,11 +3,11 @@
<% items.each do |item| %> <% items.each do |item| %>
<% if item.fetch(:current, false) || current_page?(strip_query(item.fetch(:url))) %> <% if item.fetch(:current, false) || current_page?(strip_query(item.fetch(:url))) %>
<li class="app-tab-navigation__item app-tab-navigation__item--current"> <li class="app-tab-navigation__item app-tab-navigation__item--current">
<%= govuk_link_to item[:name], item[:url], class: 'app-tab-navigation__link', aria: { current: 'page' } %> <%= govuk_link_to item[:name], item[:url], class: "app-tab-navigation__link", aria: { current: "page" } %>
</li> </li>
<% else %> <% else %>
<li class="app-tab-navigation__item"> <li class="app-tab-navigation__item">
<%= govuk_link_to item[:name], item[:url], class: 'app-tab-navigation__link' %> <%= govuk_link_to item[:name], item[:url], class: "app-tab-navigation__link" %>
</li> </li>
<% end %> <% end %>
<% end %> <% end %>

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

@ -28,21 +28,21 @@
<%= govuk_link_to log.id, case_log_path(log) %> <%= govuk_link_to log.id, case_log_path(log) %>
</th> </th>
<td class="govuk-table__cell app-!-font-tabular"> <td class="govuk-table__cell app-!-font-tabular">
<%= log.tenant_code? ? log.tenant_code : '–' %> <%= log.tenant_code? ? log.tenant_code : "–" %>
</td> </td>
<td class="govuk-table__cell app-!-font-tabular"> <td class="govuk-table__cell app-!-font-tabular">
<%= log.propcode? ? log.propcode : '–' %> <%= log.propcode? ? log.propcode : "–" %>
</td> </td>
<td class="govuk-table__cell"> <td class="govuk-table__cell">
<%= log.startdate.present? ? log.startdate.to_formatted_s(:govuk_date) : '–' %> <%= log.startdate.present? ? log.startdate.to_formatted_s(:govuk_date) : "–" %>
</td> </td>
<td class="govuk-table__cell"> <td class="govuk-table__cell">
<%= log.created_at.to_formatted_s(:govuk_date) %> <%= log.created_at.to_formatted_s(:govuk_date) %>
</td> </td>
<td class="govuk-table__cell"> <td class="govuk-table__cell">
<%= govuk_tag( <%= govuk_tag(
colour: log.status == 'completed' ? 'blue' : 'grey', colour: log.status == "completed" ? "blue" : "grey",
text: log.status.humanize text: log.status.humanize,
) %> ) %>
</td> </td>
<% if current_user.support? %> <% if current_user.support? %>
@ -59,4 +59,3 @@
</table> </table>
</section> </section>
</figure> </figure>

3
app/views/case_logs/bulk_upload.html.erb

@ -5,8 +5,7 @@
<%= f.govuk_file_field :case_log_bulk_upload, <%= f.govuk_file_field :case_log_bulk_upload,
label: { text: content_for(:title), size: "l" }, label: { text: content_for(:title), size: "l" },
hint: { text: "Upload a spreadsheet using the template" } hint: { text: "Upload a spreadsheet using the template" } %>
%>
<%= f.govuk_submit "Upload" %> <%= f.govuk_submit "Upload" %>
<% end %> <% end %>

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

@ -1,7 +1,7 @@
<% content_for :title, "Log #{@case_log.id}" %> <% content_for :title, "Log #{@case_log.id}" %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { <% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Logs" => "/logs", "Logs" => "/logs",
content_for(:title) => "" content_for(:title) => "",
}) %> }) %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">

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

@ -13,8 +13,7 @@
<% if @case_logs.present? %> <% if @case_logs.present? %>
<div class="app-filter-layout__content"> <div class="app-filter-layout__content">
<%= render partial: "log_list", locals: { case_logs: @case_logs, title: "Logs", pagy: @pagy } %> <%= render partial: "log_list", locals: { case_logs: @case_logs, title: "Logs", pagy: @pagy } %>
<%== render partial: 'pagy/nav', locals: { pagy: @pagy, item_name: "logs" } %> <%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "logs" } %>
</div> </div>
<% end %> <% end %>
</div> </div>

3
app/views/devise/confirmations/new.html.erb

@ -7,8 +7,7 @@
label: { text: "Email address" }, label: { text: "Email address" },
autocomplete: "email", autocomplete: "email",
spellcheck: "false", spellcheck: "false",
value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
%>
<%= f.govuk_submit "Resend confirmation instructions" %> <%= f.govuk_submit "Resend confirmation instructions" %>
<% end %> <% end %>

8
app/views/devise/passwords/edit.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: :back, href: :back,
) %> ) %>
<% end %> <% end %>
@ -19,12 +19,10 @@
<%= f.govuk_password_field :password, <%= f.govuk_password_field :password,
label: { text: "New password" }, label: { text: "New password" },
hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil, hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil,
autocomplete: "new-password" autocomplete: "new-password" %>
%>
<%= f.govuk_password_field :password_confirmation, <%= f.govuk_password_field :password_confirmation,
label: { text: "Confirm new password" } label: { text: "Confirm new password" } %>
%>
<%= f.govuk_submit "Update" %> <%= f.govuk_submit "Update" %>
</div> </div>

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

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: :back, href: :back,
) %> ) %>
<% end %> <% end %>
@ -22,8 +22,7 @@
<%= f.govuk_email_field :email, <%= f.govuk_email_field :email,
label: { text: "Email address" }, label: { text: "Email address" },
autocomplete: "email", autocomplete: "email",
spellcheck: "false" spellcheck: "false" %>
%>
<%= f.govuk_submit "Send email" %> <%= f.govuk_submit "Send email" %>
</div> </div>

8
app/views/devise/passwords/reset_password.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: :back, href: :back,
) %> ) %>
<% end %> <% end %>
@ -20,12 +20,10 @@
<%= f.govuk_password_field :password, <%= f.govuk_password_field :password,
label: { text: "New password" }, label: { text: "New password" },
hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil, hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil,
autocomplete: "new-password" autocomplete: "new-password" %>
%>
<%= f.govuk_password_field :password_confirmation, <%= f.govuk_password_field :password_confirmation,
label: { text: "Confirm new password" } label: { text: "Confirm new password" } %>
%>
<%= f.govuk_submit "Update" %> <%= f.govuk_submit "Update" %>
</div> </div>

6
app/views/devise/sessions/new.html.erb

@ -19,12 +19,10 @@
<%= f.govuk_email_field :email, <%= f.govuk_email_field :email,
label: { text: "Email address" }, label: { text: "Email address" },
autocomplete: "email", autocomplete: "email",
spellcheck: "false" spellcheck: "false" %>
%>
<%= f.govuk_password_field :password, <%= f.govuk_password_field :password,
autocomplete: "current-password" autocomplete: "current-password" %>
%>
<%= f.hidden_field :start, value: request["start"] %> <%= f.hidden_field :start, value: request["start"] %>
<%= f.govuk_submit "Sign in" %> <%= f.govuk_submit "Sign in" %>

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

@ -1,25 +1,25 @@
<%- if controller_name != 'sessions' %> <%- if controller_name != 'sessions' %>
<p class="govuk-body">Already have an account? <%= govuk_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>
<% end %> <% end %>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %> <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= govuk_link_to "Sign up", new_registration_path(resource_name) %><br /> <%= govuk_link_to "Sign up", new_registration_path(resource_name) %><br>
<% end %> <% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<p class="govuk-body"> You can <%= govuk_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 you’ve forgotten it.</p>
<% end %> <% end %>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= govuk_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 %> <% end %>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= govuk_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 %> <% end %>
<%- if devise_mapping.omniauthable? %> <%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %> <%- resource_class.omniauth_providers.each do |provider| %>
<%= govuk_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 %>
<% end %> <% end %>

4
app/views/devise/two_factor_authentication/resend.html.erb

@ -2,8 +2,8 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: 'javascript:history.back()', href: "javascript:history.back()",
) %> ) %>
<% end %> <% end %>

5
app/views/devise/two_factor_authentication/show.html.erb

@ -15,9 +15,8 @@
<%= f.govuk_number_field :code, <%= f.govuk_number_field :code,
label: { text: "Security code", size: "m" }, label: { text: "Security code", size: "m" },
width: 5, width: 5,
autocomplete: 'one-time-code', autocomplete: "one-time-code",
autofocus: true autofocus: true %>
%>
<%= f.govuk_submit "Submit" %> <%= f.govuk_submit "Submit" %>
</div> </div>

3
app/views/devise/unlocks/new.html.erb

@ -6,8 +6,7 @@
<%= f.govuk_email_field :email, <%= f.govuk_email_field :email,
label: { text: "Email address" }, label: { text: "Email address" },
autocomplete: "email", autocomplete: "email",
spellcheck: "false" spellcheck: "false" %>
%>
<%= f.govuk_submit "Resend unlock instructions" %> <%= f.govuk_submit "Resend unlock instructions" %>
<% end %> <% end %>

2
app/views/filters/_checkbox_filter.html.erb

@ -1,6 +1,6 @@
<%= f.govuk_check_boxes_fieldset category.to_sym, legend: { text: label, size: "s" }, small: true, form_group: { classes: "app-filter__group" } do %> <%= f.govuk_check_boxes_fieldset category.to_sym, legend: { text: label, size: "s" }, small: true, form_group: { classes: "app-filter__group" } do %>
<% options.map do |key, option| %> <% options.map do |key, option| %>
<%= f.govuk_check_box category, "#{key}", <%= f.govuk_check_box category, key.to_s,
label: { text: option }, label: { text: option },
checked: filter_selected?(category, key), checked: filter_selected?(category, key),
size: "s" %> size: "s" %>

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

@ -1,11 +1,11 @@
<div class="govuk-summary-list__row"> <div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key"> <dt class="govuk-summary-list__key">
<%= question.check_answer_label.to_s.present? ? question.check_answer_label.to_s : question.header.to_s %> <%= question.check_answer_label.to_s.presence || question.header.to_s %>
</dt> </dt>
<dd class="govuk-summary-list__value"> <dd class="govuk-summary-list__value">
<%= get_answer_label(question, @case_log) %><br/> <%= get_answer_label(question, @case_log) %><br>
<% question.get_inferred_answers(@case_log).each do |inferred_answer| %> <% question.get_inferred_answers(@case_log).each do |inferred_answer| %>
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span><br/> <span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span><br>
<% end %> <% end %>
</dd> </dd>
<dd class="govuk-summary-list__actions"> <dd class="govuk-summary-list__actions">

7
app/views/form/_checkbox_question.html.erb

@ -12,12 +12,11 @@
<%= f.govuk_check_box_divider %> <%= f.govuk_check_box_divider %>
<% else %> <% else %>
<%= f.govuk_check_box question.id, key, <%= f.govuk_check_box question.id, key,
label: { text: options['value'] }, label: { text: options["value"] },
hint: { text: options['hint'] }, hint: { text: options["hint"] },
checked: @case_log[key] == 1, checked: @case_log[key] == 1,
exclusive: after_divider, exclusive: after_divider,
**stimulus_html_attributes(question) **stimulus_html_attributes(question) %>
%>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

3
app/views/form/_date_question.html.erb

@ -5,5 +5,4 @@
legend: legend(question, page_header, conditional), legend: legend(question, page_header, conditional),
hint: { text: question.hint_text&.html_safe }, hint: { text: question.hint_text&.html_safe },
width: 20, width: 20,
**stimulus_html_attributes(question) **stimulus_html_attributes(question) %>
%>

11
app/views/form/_interruption_screen_question.html.erb

@ -1,6 +1,6 @@
<%= govuk_panel( <%= govuk_panel(
title_text: title_text, title_text:,
classes: 'app-panel--interruption', classes: "app-panel--interruption",
) do %> ) do %>
<%= display_informative_text(informative_text, case_log) %> <%= display_informative_text(informative_text, case_log) %>
<%= f.govuk_radio_buttons_fieldset question.id.to_sym, <%= f.govuk_radio_buttons_fieldset question.id.to_sym,
@ -12,10 +12,9 @@
<% else %> <% else %>
<%= f.govuk_radio_button question.id, <%= f.govuk_radio_button question.id,
key, key,
label: { text: options['value'] }, label: { text: options["value"] },
hint: { text: options['hint'] }, hint: { text: options["hint"] },
**stimulus_html_attributes(question) **stimulus_html_attributes(question) %>
%>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

6
app/views/form/_numeric_question.html.erb

@ -5,8 +5,8 @@
label: legend(question, page_header, conditional), label: legend(question, page_header, conditional),
hint: { text: question.hint_text&.html_safe }, hint: { text: question.hint_text&.html_safe },
min: question.min, max: question.max, step: question.step, min: question.min, max: question.max, step: question.step,
width: question.width, :readonly => question.read_only?, width: question.width,
readonly: question.read_only?,
prefix_text: question.prefix.to_s, prefix_text: question.prefix.to_s,
suffix_text: question.suffix.is_a?(String) ? question.suffix : nil, suffix_text: question.suffix.is_a?(String) ? question.suffix : nil,
**stimulus_html_attributes(question) **stimulus_html_attributes(question) %>
%>

19
app/views/form/_radio_question.html.erb

@ -13,22 +13,21 @@
<% if conditional_question.nil? %> <% if conditional_question.nil? %>
<%= f.govuk_radio_button question.id, <%= f.govuk_radio_button question.id,
key, key,
label: { text: options['value'] }, label: { text: options["value"] },
hint: { text: options['hint'] }, hint: { text: options["hint"] },
**stimulus_html_attributes(question) **stimulus_html_attributes(question) %>
%>
<% else %> <% else %>
<%= f.govuk_radio_button question.id, <%= f.govuk_radio_button question.id,
key, key,
label: { text: options['value'] }, label: { text: options["value"] },
hint: { text: options['hint'] }, hint: { text: options["hint"] },
**stimulus_html_attributes(question) do %> **stimulus_html_attributes(question) do %>
<%= render partial: "#{conditional_question.type}_question", locals: { <%= render partial: "#{conditional_question.type}_question", locals: {
question: conditional_question, question: conditional_question,
caption_text: caption_text, caption_text:,
page_header: page_header, page_header:,
f: f, f:,
conditional: true conditional: true,
} %> } %>
<% end %> <% end %>
<% end %> <% end %>

9
app/views/form/_select_question.html.erb

@ -1,14 +1,13 @@
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> <%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %>
<% selected = @case_log.public_send(question.id) || "" %> <% selected = @case_log.public_send(question.id) || "" %>
<%= answers = question.displayed_answer_options.map { |key, value| OpenStruct.new(id: key, name: value) } <%= answers = question.displayed_answer_options.map { |key, value| OpenStruct.new(id: key, name: value) } %>
f.govuk_collection_select question.id.to_sym, <%= f.govuk_collection_select question.id.to_sym,
answers, answers,
:id, :id,
:name, :name,
caption: caption(caption_text, page_header, conditional), caption: caption(caption_text, page_header, conditional),
label: legend(question, page_header, conditional), label: legend(question, page_header, conditional),
hint: { text: question.hint_text&.html_safe }, hint: { text: question.hint_text&.html_safe },
options: { disabled: [""], selected: selected }, options: { disabled: [""], selected: },
"data-controller": "accessible-autocomplete" "data-controller": "accessible-autocomplete" %>
%>

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

@ -4,6 +4,5 @@
caption: caption(caption_text, page_header, conditional), caption: caption(caption_text, page_header, conditional),
label: legend(question, page_header, conditional), label: legend(question, page_header, conditional),
hint: { text: question.hint_text&.html_safe }, hint: { text: question.hint_text&.html_safe },
width: question.width ? question.width : nil, width: question.width || nil,
**stimulus_html_attributes(question) **stimulus_html_attributes(question) %>
%>

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

@ -4,6 +4,5 @@
caption: caption(caption_text, page_header, conditional), caption: caption(caption_text, page_header, conditional),
label: legend(question, page_header, conditional), label: legend(question, page_header, conditional),
hint: { text: question.hint_text&.html_safe }, hint: { text: question.hint_text&.html_safe },
width: question.width ? question.width : nil, width: question.width || nil,
**stimulus_html_attributes(question) **stimulus_html_attributes(question) %>
%>

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

@ -1,8 +1,8 @@
<% content_for :title, "#{subsection.id.humanize} - Check your answers" %> <% content_for :title, "#{subsection.id.humanize} - Check your answers" %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { <% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Logs" => "/logs", "Logs" => "/logs",
"Log #{@case_log.id.to_s}" => "/logs/" + @case_log.id.to_s, "Log #{@case_log.id}" => "/logs/#{@case_log.id}",
subsection.label => "" subsection.label => "",
}) %> }) %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
@ -16,16 +16,16 @@
<dl class="govuk-summary-list"> <dl class="govuk-summary-list">
<% subsection.applicable_questions(@case_log).each do |question| %> <% subsection.applicable_questions(@case_log).each do |question| %>
<%= render partial: 'form/check_answers_table', locals: { question: question, case_log: @case_log } %> <%= render partial: "form/check_answers_table", locals: { question:, case_log: @case_log } %>
<% end %> <% end %>
</dl> </dl>
<%= form_with model: @case_log, method: "get" do |f| %> <%= form_with model: @case_log, method: "get" do |f| %>
<%= f.govuk_submit 'Save and return to log' do %> <%= f.govuk_submit "Save and return to log" do %>
<% if @case_log.status == "in_progress" && @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) == false %> <% if @case_log.status == "in_progress" && @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) == false %>
<%= govuk_button_link_to 'Save and go to next incomplete section', "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %> <%= govuk_button_link_to "Save and go to next incomplete section", "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %>
<% elsif @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) %> <% elsif @case_log.status == "completed" || @case_log.form.all_subsections_except_declaration_completed?(@case_log) %>
<%= govuk_button_link_to 'Save and go to submit', "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %> <%= govuk_button_link_to "Save and go to submit", "/logs/#{@case_log.id}/#{@case_log.form.next_incomplete_section_redirect_path(subsection, @case_log)}", secondary: true %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

2
app/views/form/guidance/_what_counts_as_income.html.erb

@ -1,4 +1,4 @@
<%= govuk_details(summary_text: 'What counts as income?') do %> <%= govuk_details(summary_text: "What counts as income?") do %>
<p class="govuk-body">You should include any income after tax from:</p> <p class="govuk-body">You should include any income after tax from:</p>
<ul class="govuk-list govuk-list--bullet"> <ul class="govuk-list govuk-list--bullet">
<li>employment</li> <li>employment</li>

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

@ -1,9 +1,9 @@
<% content_for :title, @page.header.present? ? @page.header : @page.questions.first().header.html_safe %> <% content_for :title, @page.header.presence || @page.questions.first.header.html_safe %>
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: 'javascript:history.back()', href: "javascript:history.back()",
) %> ) %>
<% end %> <% end %>
@ -11,7 +11,7 @@
<%= form_with model: @case_log, url: form_case_log_path(@case_log), method: "post", local: true do |f| %> <%= form_with model: @case_log, url: form_case_log_path(@case_log), method: "post", local: true do |f| %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class=<%= @page.questions[0].type == "interruption_screen" ? "govuk-grid-column-full-from-desktop" : "govuk-grid-column-two-thirds-from-desktop"%>> <div class="govuk-grid-column-<%= @page.questions[0].type == "interruption_screen" ? "full-from-desktop" : "two-thirds-from-desktop" %>">
<% remove_other_page_errors(@case_log, @page) %> <% remove_other_page_errors(@case_log, @page) %>
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
@ -29,14 +29,14 @@
<% end %> <% end %>
<% @page.non_conditional_questions.map do |question| %> <% @page.non_conditional_questions.map do |question| %>
<div id=<%= question.id + "_div " %><%= display_question_key_div(@page, question) %> > <div id="<%= question.id %>_div" <%= display_question_key_div(@page, question) %>>
<% if question.read_only? %> <% if question.read_only? %>
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m"> <hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m">
<% end %> <% end %>
<% if question.type == "interruption_screen" %> <% if question.type == "interruption_screen" %>
<%= render partial: "form/#{question.type}_question", locals: { question: question, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, title_text: @page.title_text, informative_text: @page.informative_text, form: @form, f: f, conditional: false } %> <%= render partial: "form/#{question.type}_question", locals: { question:, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, title_text: @page.title_text, informative_text: @page.informative_text, form: @form, f:, conditional: false } %>
<% else %> <% else %>
<%= render partial: "form/#{question.type}_question", locals: { question: question, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, f: f, conditional: false } %> <%= render partial: "form/#{question.type}_question", locals: { question:, caption_text: @subsection.label, page_header: @page.header, case_log: @case_log, f:, conditional: false } %>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>

13
app/views/layouts/_collection_resources.html.erb

@ -1,13 +1,16 @@
<div class="app-card"> <div class="app-card">
<h2 class="govuk-heading-s">Collection resources</h2> <h2 class="govuk-heading-s">Collection resources</h2>
<%= render DocumentListComponent.new(items: [{ <%= render DocumentListComponent.new(items: [
{
name: "Lettings log for tenants (2022/23)", name: "Lettings log for tenants (2022/23)",
href: "https://core.communities.gov.uk/public/download/guides-and-manuals/2022-23%20Lettings%20paper%20form.pdf?download-format=pdf", href: "https://core.communities.gov.uk/public/download/guides-and-manuals/2022-23%20Lettings%20paper%20form.pdf?download-format=pdf",
metadata: "PDF, 654 KB, 4 pages" metadata: "PDF, 654 KB, 4 pages",
}, { },
{
name: "Lettings log for tenants (2021/22)", name: "Lettings log for tenants (2021/22)",
href: "https://core.communities.gov.uk/public/download/guides-and-manuals/2021_22%20Lettings%20Log.pdf?download-format=pdf", href: "https://core.communities.gov.uk/public/download/guides-and-manuals/2021_22%20Lettings%20Log.pdf?download-format=pdf",
metadata: "PDF, 302 KB, 3 pages" metadata: "PDF, 302 KB, 3 pages",
}]) %> },
]) %>
</div> </div>

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

@ -4,21 +4,21 @@
<title><%= browser_title(yield(:title), @pagy, @admin_user, @user, @organisation, @case_log, @resource) %></title> <title><%= browser_title(yield(:title), @pagy, @admin_user, @user, @organisation, @case_log, @resource) %></title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>
<%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %> <%= tag.meta name: "viewport", content: "width=device-width, initial-scale=1" %>
<%= tag :meta, property: 'og:image', content: asset_path('images/govuk-opengraph-image.png') %> <%= tag.meta property: "og:image", content: asset_path("images/govuk-opengraph-image.png") %>
<%= tag :meta, name: 'theme-color', content: '#0b0c0c' %> <%= tag.meta name: "theme-color", content: "#0b0c0c" %>
<%= favicon_link_tag asset_path('images/favicon.ico') %> <%= favicon_link_tag asset_path("images/favicon.ico") %>
<%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %> <%= favicon_link_tag asset_path("images/govuk-mask-icon.svg"), rel: "mask-icon", type: "image/svg", color: "#0b0c0c" %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %> <%= favicon_link_tag asset_path("images/govuk-apple-touch-icon.png"), rel: "apple-touch-icon", type: "image/png" %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %> <%= favicon_link_tag asset_path("images/govuk-apple-touch-icon-152x152.png"), rel: "apple-touch-icon", type: "image/png", size: "152x152" %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %> <%= favicon_link_tag asset_path("images/govuk-apple-touch-icon-167x167.png"), rel: "apple-touch-icon", type: "image/png", size: "167x167" %>
<%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %> <%= favicon_link_tag asset_path("images/govuk-apple-touch-icon-180x180.png"), rel: "apple-touch-icon", type: "image/png", size: "180x180" %>
<%= stylesheet_link_tag "application" %> <%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "vendor/html5shiv.min.js" %> <%= javascript_include_tag "vendor/html5shiv.min.js" %>
<%= javascript_tag do -%> <script>
window.html5.elements = 'output'; window.html5.elements = "output";
html5.shivDocument(document); html5.shivDocument(document);
<% end -%> </script>
<%= javascript_include_tag "vendor/polyfill-output-value.js" %> <%= javascript_include_tag "vendor/polyfill-output-value.js" %>
<%= javascript_include_tag "vendor/outerHTML.js" %> <%= javascript_include_tag "vendor/outerHTML.js" %>
<%= javascript_include_tag "application", defer: true %> <%= javascript_include_tag "application", defer: true %>
@ -37,46 +37,45 @@
<body class="govuk-template__body app-template--wide"> <body class="govuk-template__body app-template--wide">
<script> <script>
document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); document.body.className = ((document.body.className) ? document.body.className + " js-enabled" : "js-enabled");
</script> </script>
<%= govuk_skip_link %> <%= govuk_skip_link %>
<%= govuk_header( <%= govuk_header(
logotype: 'GOV.UK', logotype: "GOV.UK",
service_name: t('service_name'), service_name: t("service_name"),
service_url: current_user.nil? ? "/" : '/logs' service_url: current_user.nil? ? "/" : "/logs",
) do |component| ) do |component|
if current_user.nil? if current_user.nil?
component.navigation_item(text: 'Sign in', href: user_session_path) component.navigation_item(text: "Sign in", href: user_session_path)
elsif else
component.navigation_item(text: '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 organisation", href: "/organisations/#{current_user.organisation.id}")
component.navigation_item(text: 'Your account', href: account_path) component.navigation_item(text: "Your account", href: account_path)
component.navigation_item(text: 'Sign out', href: destroy_user_session_path) component.navigation_item(text: "Sign out", href: destroy_user_session_path)
end end
end end %>
%>
<div class="govuk-width-container"> <div class="govuk-width-container">
<aside> <aside>
<%= govuk_phase_banner( <%= govuk_phase_banner(
tag: { text: 'Beta' }, tag: { text: "Beta" },
text: "This is a new service – help us improve it by <a class=\"govuk-link\" href=\"#{t('feedback_form')}\" rel=\"noreferrer noopener\" target=\"_blank\">giving us your feedback (opens in a new tab)</a>".html_safe text: "This is a new service – help us improve it by <a class=\"govuk-link\" href=\"#{t('feedback_form')}\" rel=\"noreferrer noopener\" target=\"_blank\">giving us your feedback (opens in a new tab)</a>".html_safe,
) %> ) %>
<%= content_for(:breadcrumbs) %> <%= content_for(:breadcrumbs) %>
<%= content_for(:before_content) %> <%= content_for(:before_content) %>
</aside> </aside>
<main class="govuk-main-wrapper" id="main-content" role="main"> <main class="govuk-main-wrapper" id="main-content" role="main">
<% if flash.notice && !flash.notice.include?('translation missing') %> <% if flash.notice && !flash.notice.include?("translation missing") %>
<%= govuk_notification_banner( <%= govuk_notification_banner(
title_text: 'Success', title_text: "Success",
success: true, title_heading_level: 3, success: true, title_heading_level: 3,
title_id: "swanky-notifications") do |notification_banner| title_id: "swanky-notifications"
) do |notification_banner|
notification_banner.heading(text: flash.notice) notification_banner.heading(text: flash.notice)
end end %>
%>
<% end %> <% end %>
<%= content_for?(:content) ? yield(:content) : yield %> <%= content_for?(:content) ? yield(:content) : yield %>
</main> </main>

2
app/views/layouts/mailer.html.erb

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style> <style>
/* Email styles need to be inline */ /* Email styles need to be inline */
</style> </style>

2
app/views/layouts/organisations.html.erb

@ -5,7 +5,7 @@
<% items = tab_items(current_user) %> <% items = tab_items(current_user) %>
<%= render TabNavigationComponent.new(items: items) %> <%= render TabNavigationComponent.new(items:) %>
<h2 class="govuk-visually-hidden"><%= content_for(:tab_title) %></h2> <h2 class="govuk-visually-hidden"><%= content_for(:tab_title) %></h2>

17
app/views/organisations/edit.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: :back, href: :back,
) %> ) %>
<% end %> <% end %>
@ -15,29 +15,24 @@
</h1> </h1>
<%= f.govuk_text_field :name, <%= f.govuk_text_field :name,
autocomplete: "name" autocomplete: "name" %>
%>
<%= f.govuk_text_field :address_line1, <%= f.govuk_text_field :address_line1,
label: { text: "Address line 1" }, label: { text: "Address line 1" },
autocomplete: "address-line1" autocomplete: "address-line1" %>
%>
<%= f.govuk_text_field :address_line2, <%= f.govuk_text_field :address_line2,
label: { text: "Address line 2" }, label: { text: "Address line 2" },
autocomplete: "address-line2" autocomplete: "address-line2" %>
%>
<%= f.govuk_text_field :postcode, <%= f.govuk_text_field :postcode,
autocomplete: "postal-code", autocomplete: "postal-code",
width: 10 width: 10 %>
%>
<%= f.govuk_phone_field :phone, <%= f.govuk_phone_field :phone,
label: { text: "Telephone number" }, label: { text: "Telephone number" },
autocomplete: "tel", autocomplete: "tel",
width: 20 width: 20 %>
%>
<%= f.govuk_submit "Save changes" %> <%= f.govuk_submit "Save changes" %>
</div> </div>

24
app/views/organisations/show.html.erb

@ -10,17 +10,21 @@
<% @organisation.display_attributes.each do |attr| %> <% @organisation.display_attributes.each do |attr| %>
<% if current_user.data_coordinator? && attr[:editable] %> <% if current_user.data_coordinator? && attr[:editable] %>
<%= summary_list.row do |row| <%= summary_list.row do |row| %>
row.key { attr[:name].to_s.humanize } <% row.key { attr[:name].to_s.humanize } %>
row.value { simple_format(attr[:value].to_s, {}, wrapper_tag: "div") } <% row.value { simple_format(attr[:value].to_s, {}, wrapper_tag: "div") } %>
row.action(visually_hidden_text: 'name', href: edit_organisation_path, html_attributes: { 'data-qa': "change-#{attr[:name]}" }) <% row.action(
end %> visually_hidden_text: "name",
href: edit_organisation_path,
html_attributes: { "data-qa": "change-#{attr[:name]}" },
) %>
<% end %>
<% else %> <% else %>
<%= summary_list.row do |row| <%= summary_list.row do |row| %>
row.key { attr[:name].to_s.humanize } <% row.key { attr[:name].to_s.humanize } %>
row.value { simple_format(attr[:value].to_s, {}, wrapper_tag: "div") } <% row.value { simple_format(attr[:value].to_s, {}, wrapper_tag: "div") } %>
row.action() <% row.action %>
end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

20
app/views/organisations/users.html.erb

@ -9,19 +9,19 @@
<% end %> <% end %>
<%= govuk_table do |table| %> <%= govuk_table do |table| %>
<%= table.head do |head| %> <%= table.head do |head| %>
<%= head.row do |row| <%= head.row do |row| %>
row.cell(header: true, text: "Name and email adress") <% row.cell(header: true, text: "Name and email adress") %>
row.cell(header: true, text: "Organisation and role") <% row.cell(header: true, text: "Organisation and role") %>
row.cell(header: true, text: "Last logged in") <% row.cell(header: true, text: "Last logged in") %>
end %> <% end %>
<% end %> <% end %>
<% @organisation.users.each do |user| %> <% @organisation.users.each do |user| %>
<%= table.body do |body| %> <%= table.body do |body| %>
<%= body.row do |row| <%= body.row do |row| %>
row.cell(text: simple_format(user_cell(user), {}, wrapper_tag: "div")) <% row.cell(text: simple_format(user_cell(user), {}, wrapper_tag: "div")) %>
row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div")) <% row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div")) %>
row.cell(text: user.last_sign_in_at&.to_formatted_s(:govuk_date) ) <% row.cell(text: user.last_sign_in_at&.to_formatted_s(:govuk_date)) %>
end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

6
app/views/pagy/_nav.html.erb

@ -5,7 +5,7 @@
<ul class="app-pagination__list"> <ul class="app-pagination__list">
<li class="app-pagination__item app-pagination__item--prev"> <li class="app-pagination__item app-pagination__item--prev">
<% if pagy.prev %> <% if pagy.prev %>
<a class="app-pagination__link" href=<%= "/logs?page=#{pagy.prev}" %>> <a class="app-pagination__link" href="<%= "/logs?page=#{pagy.prev}" %>">
<% end %> <% end %>
<span class="app-pagination__link-title"> <span class="app-pagination__link-title">
<svg class="app-pagination__icon" xmlns="http://www.w3.org/2000/svg" height="13" width="17"> <svg class="app-pagination__icon" xmlns="http://www.w3.org/2000/svg" height="13" width="17">
@ -20,12 +20,12 @@
<% elsif item.is_a?(String) %> <% elsif item.is_a?(String) %>
<li class="app-pagination__item app-pagination__item--current"><span class="govuk-visually-hidden">Page </span><%= item %><span class="govuk-visually-hidden"> (current page) </span></li> <li class="app-pagination__item app-pagination__item--current"><span class="govuk-visually-hidden">Page </span><%= item %><span class="govuk-visually-hidden"> (current page) </span></li>
<% else %> <% else %>
<li class="app-pagination__item"><a class="app-pagination__link" href=<%= "/logs?page=#{item}" %>><span class="govuk-visually-hidden">Page </span><%= item %></a></li> <li class="app-pagination__item"><a class="app-pagination__link" href="<%= "/logs?page=#{item}" %>"><span class="govuk-visually-hidden">Page </span><%= item %></a></li>
<% end %> <% end %>
<% end %> <% end %>
<li class="app-pagination__item app-pagination__item--next"> <li class="app-pagination__item app-pagination__item--next">
<% if pagy.next %> <% if pagy.next %>
<a class="app-pagination__link" href=<%= "/logs?page=#{pagy.next}" %>> <a class="app-pagination__link" href="<%= "/logs?page=#{pagy.next}" %>">
<% end %> <% end %>
Next <span class="govuk-visually-hidden">page</span> Next <span class="govuk-visually-hidden">page</span>
<span class="app-pagination__link-title"> <span class="app-pagination__link-title">

6
app/views/start/index.html.erb

@ -10,10 +10,10 @@
<p class="govuk-body">The data will be used to update the national record for social housing. It will also help to inform policy about the cost of social housing and what type of housing needs to be built.</p> <p class="govuk-body">The data will be used to update the national record for social housing. It will also help to inform policy about the cost of social housing and what type of housing needs to be built.</p>
<p class="govuk-body">This service is only for social housing in England.</p> <p class="govuk-body">This service is only for social housing in England.</p>
<% start_path = current_user ? case_logs_path : (user_session_path + "?start=true") %> <% start_path = current_user ? case_logs_path : "#{user_session_path}?start=true" %>
<%= govuk_start_button( <%= govuk_start_button(
text: 'Start now', text: "Start now",
href: start_path href: start_path,
) %> ) %>
<h2 class="govuk-heading-m">Before you start</h2> <h2 class="govuk-heading-m">Before you start</h2>

23
app/views/users/edit.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: :back, href: :back,
) %> ) %>
<% end %> <% end %>
@ -17,36 +17,35 @@
</h1> </h1>
<%= f.govuk_text_field :name, <%= f.govuk_text_field :name,
autocomplete: "name" autocomplete: "name" %>
%>
<%= f.govuk_email_field :email, <%= f.govuk_email_field :email,
label: { text: "Email address" }, label: { text: "Email address" },
autocomplete: "email", autocomplete: "email",
spellcheck: "false" spellcheck: "false" %>
%>
<% if current_user.data_coordinator? || current_user.support? %> <% if current_user.data_coordinator? || current_user.support? %>
<%= roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } <%= roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %>
f.govuk_collection_radio_buttons :role, roles, :id, :name, legend: { text: "Role", size: "m" } <%= f.govuk_collection_radio_buttons :role,
%> roles,
:id,
:name,
legend: { text: "Role", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_dpo, <%= f.govuk_collection_radio_buttons :is_dpo,
[OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], [OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")],
:id, :id,
:name, :name,
inline: true, inline: true,
legend: { text: "Are #{pronoun(@user, current_user)} a data protection officer?", size: "m" } legend: { text: "Are #{pronoun(@user, current_user)} a data protection officer?", size: "m" } %>
%>
<%= f.govuk_collection_radio_buttons :is_key_contact, <%= f.govuk_collection_radio_buttons :is_key_contact,
[OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], [OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")],
:id, :id,
:name, :name,
inline: true, inline: true,
legend: { text: "Are #{pronoun(@user, current_user)} a key contact?", size: "m" } legend: { text: "Are #{pronoun(@user, current_user)} a key contact?", size: "m" } %>
%>
<% end %> <% end %>
<%= f.govuk_submit "Save changes" %> <%= f.govuk_submit "Save changes" %>

24
app/views/users/new.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: :back, href: :back,
) %> ) %>
<% end %> <% end %>
@ -17,35 +17,35 @@
</h1> </h1>
<%= f.govuk_text_field :name, <%= f.govuk_text_field :name,
autocomplete: "name" autocomplete: "name" %>
%>
<%= f.govuk_email_field :email, <%= f.govuk_email_field :email,
label: { text: "Email address" }, label: { text: "Email address" },
autocomplete: "email", autocomplete: "email",
spellcheck: "false", spellcheck: "false",
value: @resource.email value: @resource.email %>
%>
<%= roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } <%= roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %>
f.govuk_collection_radio_buttons :role, roles, :id, :name, legend: { text: "Role", size: "m" }
%> <%= f.govuk_collection_radio_buttons :role,
roles,
:id,
:name,
legend: { text: "Role", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_dpo, <%= f.govuk_collection_radio_buttons :is_dpo,
[OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], [OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")],
:id, :id,
:name, :name,
inline: true, inline: true,
legend: { text: "Are #{pronoun(@user, current_user)} a data protection officer?", size: "m" } legend: { text: "Are #{pronoun(@user, current_user)} a data protection officer?", size: "m" } %>
%>
<%= f.govuk_collection_radio_buttons :is_key_contact, <%= f.govuk_collection_radio_buttons :is_key_contact,
[OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], [OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")],
:id, :id,
:name, :name,
inline: true, inline: true,
legend: { text: "Are #{pronoun(@user, current_user)} a key contact?", size: "m" } legend: { text: "Are #{pronoun(@user, current_user)} a key contact?", size: "m" } %>
%>
<%= f.govuk_submit "Continue" %> <%= f.govuk_submit "Continue" %>
</div> </div>

40
app/views/users/show.html.erb

@ -17,17 +17,17 @@
if can_edit_names?(@user, current_user) if can_edit_names?(@user, current_user)
row.action(visually_hidden_text: "name", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-name" }) row.action(visually_hidden_text: "name", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-name" })
else else
row.action() row.action
end end
end %> end %>
<%= summary_list.row() do |row| <%= summary_list.row do |row|
row.key { "Email address" } row.key { "Email address" }
row.value { @user.email } row.value { @user.email }
if can_edit_emails?(@user, current_user) if can_edit_emails?(@user, current_user)
row.action(visually_hidden_text: "email address", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-email-address" }) row.action(visually_hidden_text: "email address", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-email-address" })
else else
row.action() row.action
end end
end %> end %>
@ -35,25 +35,33 @@
row.key { "Password" } row.key { "Password" }
row.value { "••••••••" } row.value { "••••••••" }
if can_edit_password?(@user, current_user) if can_edit_password?(@user, current_user)
row.action(visually_hidden_text: "password", href: edit_password_account_path, html_attributes: { "data-qa": "change-password" }) row.action(
visually_hidden_text: "password",
href: edit_password_account_path,
html_attributes: { "data-qa": "change-password" },
)
else else
row.action() row.action
end end
end %> end %>
<%= summary_list.row do |row| <%= summary_list.row do |row|
row.key { "Organisation" } row.key { "Organisation" }
row.value { @user.organisation.name } row.value { @user.organisation.name }
row.action() row.action
end %> end %>
<%= summary_list.row do |row| <%= summary_list.row do |row|
row.key { "Role" } row.key { "Role" }
row.value { @user.role.humanize } row.value { @user.role.humanize }
if can_edit_roles?(@user, current_user) if can_edit_roles?(@user, current_user)
row.action(visually_hidden_text: "role", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-role" }) row.action(
visually_hidden_text: "role",
href: aliased_user_edit(@user, current_user),
html_attributes: { "data-qa": "change-role" },
)
else else
row.action() row.action
end end
end %> end %>
@ -61,9 +69,13 @@
row.key { "Data protection officer" } row.key { "Data protection officer" }
row.value { @user.is_data_protection_officer? ? "Yes" : "No" } row.value { @user.is_data_protection_officer? ? "Yes" : "No" }
if can_edit_dpo?(@user, current_user) if can_edit_dpo?(@user, current_user)
row.action(visually_hidden_text: "are #{pronoun(@user, current_user)} a data protection officer?", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-data-protection-officer" }) row.action(
visually_hidden_text: "are #{pronoun(@user, current_user)} a data protection officer?",
href: aliased_user_edit(@user, current_user),
html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-data-protection-officer" },
)
else else
row.action() row.action
end end
end %> end %>
@ -71,9 +83,13 @@
row.key { "Key contact" } row.key { "Key contact" }
row.value { @user.is_key_contact? ? "Yes" : "No" } row.value { @user.is_key_contact? ? "Yes" : "No" }
if can_edit_key_contact?(@user, current_user) if can_edit_key_contact?(@user, current_user)
row.action(visually_hidden_text: "are #{pronoun(@user, current_user)} a key contact?", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-key-contact" }) row.action(
visually_hidden_text: "are #{pronoun(@user, current_user)} a key contact?",
href: aliased_user_edit(@user, current_user),
html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-key-contact" },
)
else else
row.action() row.action
end end
end %> end %>
<% end %> <% end %>

8
spec/features/reset_password.html.erb

@ -2,7 +2,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: 'Back', text: "Back",
href: :back, href: :back,
) %> ) %>
<% end %> <% end %>
@ -20,12 +20,10 @@
<%= f.govuk_password_field :password, <%= f.govuk_password_field :password,
label: { text: "New password" }, label: { text: "New password" },
hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil, hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil,
autocomplete: "new-password" autocomplete: "new-password" %>
%>
<%= f.govuk_password_field :password_confirmation, <%= f.govuk_password_field :password_confirmation,
label: { text: "Confirm new password" } label: { text: "Confirm new password" } %>
%>
<%= f.govuk_submit "Update" %> <%= f.govuk_submit "Update" %>
</div> </div>

Loading…
Cancel
Save