Skip to content

Commit

Permalink
Merge pull request #2337 from DFE-Digital/suitability-improvements
Browse files Browse the repository at this point in the history
Improve suitability summary interface
  • Loading branch information
thomasleese authored Jul 29, 2024
2 parents 4324c8e + 7dfecae commit 2a3e014
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% title = "Archive suitability record for #{@suitability_record.name}" %>

<% content_for :page_title, title %>
<% content_for :back_link_url, assessor_interface_suitability_records_path %>
<% content_for :back_link_url, edit_assessor_interface_suitability_record_path %>

<%= form_with model: @form, url: [:assessor_interface, @suitability_record], method: :delete do |f| %>
<%= f.govuk_error_summary %>
Expand All @@ -11,6 +11,6 @@
<%= f.govuk_text_area :note %>

<%= f.govuk_submit "Archive record" do %>
<%= govuk_link_to "Cancel", %i[assessor_interface suitability_records] %>
<%= govuk_link_to "Cancel", edit_assessor_interface_suitability_record_path %>
<% end %>
<% end %>
26 changes: 14 additions & 12 deletions app/views/assessor_interface/suitability_records/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
row.with_value { @suitability_record.name }
end

@suitability_record.aliases.each do |name_alias|
if (aliases = @suitability_record.aliases).present?
summary_list.with_row do |row|
row.with_key { "Alias" }
row.with_value { name_alias }
row.with_key { "Aliases" }
row.with_value { aliases.join("<br />").html_safe }
end
end

@suitability_record.emails.map(&:value).each do |email|
if (emails = @suitability_record.emails.map(&:value)).present?
summary_list.with_row do |row|
row.with_key { "Email address" }
row.with_value { email }
row.with_key { "Email addresses" }
row.with_value { emails.join("<br />").html_safe }
end
end

Expand All @@ -40,10 +40,10 @@
row.with_value { @suitability_record.date_of_birth.to_fs }
end

@suitability_record.application_forms.pluck(:reference).sort.each do |reference|
if (references = @suitability_record.application_forms.pluck(:reference).map(&:to_s).sort).present?
summary_list.with_row do |row|
row.with_key { "Application reference" }
row.with_value { reference.to_s }
row.with_key { "Application references" }
row.with_value { references.join("<br />").html_safe }
end
end

Expand All @@ -59,13 +59,13 @@

summary_list.with_row do |row|
row.with_key { "Date added" }
row.with_value { @suitability_record.created_at.to_fs }
row.with_value { @suitability_record.created_at.localtime.to_fs }
end

if @suitability_record.updated_at != @suitability_record.created_at
summary_list.with_row do |row|
row.with_key { "Date last updated" }
row.with_value { @suitability_record.updated_at.to_fs }
row.with_value { @suitability_record.updated_at.localtime.to_fs }
end
end

Expand All @@ -83,7 +83,9 @@
end %>

<% if @suitability_record.archived? %>
<%= f.govuk_submit "Set to active", secondary: true %>
<%= f.govuk_submit "Set to active" do %>
<%= govuk_link_to "Cancel", %i[assessor_interface suitability_records] %>
<% end %>
<% else %>
<h2 class="govuk-heading-m govuk-!-padding-top-6">Update record</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<%= govuk_summary_list(actions: false) do |summary_list|
summary_list.with_row do |row|
row.with_key { "Date added" }
row.with_value { suitability_record.created_at.to_fs }
row.with_value { suitability_record.created_at.localtime.to_fs }
end

if suitability_record.updated_at != suitability_record.created_at
summary_list.with_row do |row|
row.with_key { "Date last updated" }
row.with_value { suitability_record.updated_at.to_fs }
row.with_value { suitability_record.updated_at.localtime.to_fs }
end
end

Expand Down
6 changes: 3 additions & 3 deletions config/locales/assessor_interface.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ en:
assessor_interface/suitability_record_form:
attributes:
name:
blank: Enter a name
blank: Enter the name
location:
blank: Enter a country trained in
blank: Enter the country trained in
date_of_birth:
blank: Enter a date of birth
blank: Enter the date of birth
note:
blank: Briefly explain why you have created this suitability record
assessor_interface/upload_unsigned_consent_document_form:
Expand Down

0 comments on commit 2a3e014

Please sign in to comment.