From c869ebdebebe5333768f1fedf1fa91029d82ab91 Mon Sep 17 00:00:00 2001 From: starswan Date: Fri, 20 Dec 2024 14:59:21 +0000 Subject: [PATCH] DRY display of qualification in views --- .../jobseekers/profiles/qualifications_controller.rb | 2 +- .../review/qualifications/_secondary_qualification.html.slim | 2 +- .../profiles/qualifications/confirm_destroy.html.slim | 2 +- app/views/jobseekers/qualifications/_qualifications.html.slim | 2 +- .../qualifications/review/_secondary_qualification.html.slim | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/jobseekers/profiles/qualifications_controller.rb b/app/controllers/jobseekers/profiles/qualifications_controller.rb index f3e3c7471b..907c3cee19 100644 --- a/app/controllers/jobseekers/profiles/qualifications_controller.rb +++ b/app/controllers/jobseekers/profiles/qualifications_controller.rb @@ -71,7 +71,7 @@ def qualification_params (params[qualification_form_param_key(@category)] || params).permit(:category) when "create", "edit", "update" params.require(qualification_form_param_key(@category)) - .permit(:category, :finished_studying, :finished_studying_details, :grade, :institution, :name, :subject, :year, qualification_results_attributes: %i[id subject grade]) + .permit(:category, :finished_studying, :finished_studying_details, :grade, :institution, :name, :subject, :year, qualification_results_attributes: %i[id subject grade awarding_body]) end end diff --git a/app/views/jobseekers/job_applications/review/qualifications/_secondary_qualification.html.slim b/app/views/jobseekers/job_applications/review/qualifications/_secondary_qualification.html.slim index 65fd38161f..4e27b6d9d8 100644 --- a/app/views/jobseekers/job_applications/review/qualifications/_secondary_qualification.html.slim +++ b/app/views/jobseekers/job_applications/review/qualifications/_secondary_qualification.html.slim @@ -1,5 +1,5 @@ p class="govuk-!-margin-bottom-1" - = qualification.qualification_results.map { |result| "#{result.subject} (#{result.grade.upcase})" }.join(", ") + = qualification.qualification_results.map { |result| display_secondary_qualification(result) }.join(", ") p.govuk-caption-m - if qualification.display_attributes.include?("institution") diff --git a/app/views/jobseekers/profiles/qualifications/confirm_destroy.html.slim b/app/views/jobseekers/profiles/qualifications/confirm_destroy.html.slim index ea3320811d..8841f69eb4 100644 --- a/app/views/jobseekers/profiles/qualifications/confirm_destroy.html.slim +++ b/app/views/jobseekers/profiles/qualifications/confirm_destroy.html.slim @@ -28,7 +28,7 @@ - row.with_value text: qualification.year - summary_list.with_row do |row| - row.with_key text: t("jobseekers.qualifications.subjects_and_grades") - - row.with_value text: safe_join(qualification.qualification_results.map { |res| tag.div("#{res.subject} – #{res.grade}", class: "govuk-body govuk-!-margin-bottom-1") }) + - row.with_value text: safe_join(qualification.qualification_results.map { |res| tag.div(display_secondary_qualification(res), class: "govuk-body govuk-!-margin-bottom-1") }) - else - summary_list.with_row do |row| - row.with_key text: "Type" diff --git a/app/views/jobseekers/qualifications/_qualifications.html.slim b/app/views/jobseekers/qualifications/_qualifications.html.slim index f17b4dd0ee..c863bbd8f6 100644 --- a/app/views/jobseekers/qualifications/_qualifications.html.slim +++ b/app/views/jobseekers/qualifications/_qualifications.html.slim @@ -6,7 +6,7 @@ - if qualification.secondary? - summary_list.with_row do |row| - row.with_key text: t("jobseekers.profiles.qualifications.subjects_and_grades") - - row.with_value text: safe_join(qualification.qualification_results.map { |res| tag.div("#{res.subject} – #{res.grade}", class: "govuk-body govuk-!-margin-bottom-1") }) + - row.with_value text: safe_join(qualification.qualification_results.map { |res| tag.div(display_secondary_qualification(res), class: "govuk-body govuk-!-margin-bottom-1") }) - qualification.display_attributes.each do |attribute| - summary_list.with_row do |row| diff --git a/app/views/jobseekers/qualifications/review/_secondary_qualification.html.slim b/app/views/jobseekers/qualifications/review/_secondary_qualification.html.slim index 65fd38161f..4e27b6d9d8 100644 --- a/app/views/jobseekers/qualifications/review/_secondary_qualification.html.slim +++ b/app/views/jobseekers/qualifications/review/_secondary_qualification.html.slim @@ -1,5 +1,5 @@ p class="govuk-!-margin-bottom-1" - = qualification.qualification_results.map { |result| "#{result.subject} (#{result.grade.upcase})" }.join(", ") + = qualification.qualification_results.map { |result| display_secondary_qualification(result) }.join(", ") p.govuk-caption-m - if qualification.display_attributes.include?("institution")