diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d81c0b2b73..2f33b1635b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,8 +24,8 @@ jobs: - name: Run Rubocop run: bundle exec rubocop - - name: Run Slim-Lint with PR annotations - run: bundle exec slim-lint -r github app/views app/components + - name: Run Slim-Lint + run: bundle exec slim-lint app/views app/components - name: Run Brakeman run: bundle exec brakeman diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d705bf996a..2a0d383e43 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,12 @@ # This configuration was generated by # `rubocop --auto-gen-config --exclude-limit 350` -# on 2024-10-31 16:37:50 UTC using RuboCop version 1.64.1. +# on 2024-12-11 09:39:27 UTC using RuboCop version 1.69.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 132 +# Offense count: 131 # Configuration parameters: EnforcedStyle. # SupportedStyles: link_or_button, strict Capybara/ClickLinkOrButtonStyle: @@ -46,7 +46,6 @@ Capybara/CurrentPathExpectation: - 'spec/system/jobseekers/jobseekers_can_add_qualifications_to_their_job_application_spec.rb' - 'spec/system/jobseekers/jobseekers_can_add_qualifications_to_their_profile_spec.rb' - 'spec/system/jobseekers/jobseekers_can_add_references_to_their_job_application_spec.rb' - - 'spec/system/jobseekers/jobseekers_can_change_password_spec.rb' - 'spec/system/jobseekers/jobseekers_can_close_and_reactivate_account_spec.rb' - 'spec/system/jobseekers/jobseekers_can_complete_a_job_application_spec.rb' - 'spec/system/jobseekers/jobseekers_can_create_a_job_alert_from_a_mailing_campaign_spec.rb' @@ -100,7 +99,7 @@ Capybara/CurrentPathExpectation: - 'spec/system/support_users/dfe_sign_in_spec.rb' - 'spec/system/support_users/fallback_sign_in_spec.rb' -# Offense count: 235 +# Offense count: 234 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: have_no, not_to @@ -277,7 +276,7 @@ Layout/MultilineArrayLineBreaks: - 'spec/system/publishers/publishers_can_search_for_jobseeker_profiles_spec.rb' - 'spec/system/publishers/publishers_can_view_a_jobseeker_profile_spec.rb' -# Offense count: 29 +# Offense count: 37 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultilineFinalElement. Layout/MultilineHashKeyLineBreaks: @@ -317,12 +316,12 @@ Lint/MissingSuper: Metrics/BlockLength: Max: 28 -# Offense count: 19 +# Offense count: 18 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 188 + Max: 179 -# Offense count: 91 +# Offense count: 89 RSpec/AnyInstance: Exclude: - 'spec/controllers/jobseekers/subscriptions_controller_spec.rb' @@ -373,13 +372,12 @@ RSpec/AnyInstance: - 'spec/system/publishers/publishers_get_email_notifications_from_job_applications_spec.rb' - 'spec/validators/form_file_validator_spec.rb' -# Offense count: 79 +# Offense count: 78 # This cop supports unsafe autocorrection (--autocorrect-all). RSpec/BeEq: Exclude: - 'spec/components/environment_banner_component_spec.rb' - 'spec/components/scheduled_maintenance_banner_component_spec.rb' - - 'spec/form_models/publishers/job_listing/applying_for_the_job_form_spec.rb' - 'spec/helpers/job_applications_helper_spec.rb' - 'spec/lib/flag_spec.rb' - 'spec/models/school_spec.rb' @@ -387,7 +385,6 @@ RSpec/BeEq: - 'spec/models/vacancy_spec.rb' - 'spec/presenters/subscription_presenter_spec.rb' - 'spec/requests/subscriptions_spec.rb' - - 'spec/services/campaign_search_params_merger_spec.rb' - 'spec/services/jobseekers/account_transfer_spec.rb' - 'spec/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile_spec.rb' - 'spec/services/jobseekers/job_applications/prefill_job_application_from_previous_application_spec.rb' @@ -415,7 +412,7 @@ RSpec/ChangeByZero: - 'spec/jobs/import_from_vacancy_source_job_spec.rb' - 'spec/requests/subscriptions_spec.rb' -# Offense count: 127 +# Offense count: 125 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: @@ -469,7 +466,7 @@ RSpec/ContextWording: - 'spec/system/publishers/publishers_have_to_accept_terms_spec.rb' - 'spec/system/support_users/feedback_spec.rb' -# Offense count: 54 +# Offense count: 50 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants. # SupportedStyles: described_class, explicit @@ -479,7 +476,6 @@ RSpec/DescribedClass: - 'spec/helpers/vacancies_helper_spec.rb' - 'spec/jobs/alert_mailer_job_spec.rb' - 'spec/lib/google_indexing_spec.rb' - - 'spec/lib/message_encryptor_spec.rb' - 'spec/lib/modules/aws_ip_ranges_spec.rb' - 'spec/meta/factories/support/random_helpers_spec.rb' - 'spec/models/organisation_spec.rb' @@ -577,13 +573,12 @@ RSpec/ExampleWording: - 'spec/system/other/users_can_view_the_sub_navigation_spec.rb' - 'spec/system/publishers/publishers_can_search_for_jobseeker_profiles_spec.rb' -# Offense count: 11 +# Offense count: 10 # This cop supports safe autocorrection (--autocorrect). RSpec/ExcessiveDocstringSpacing: Exclude: - 'spec/form_models/publishers/job_listing/about_the_role_form_spec.rb' - 'spec/lib/dfe_sign_in/api/request_spec.rb' - - 'spec/requests/jobseekers/job_applications_spec.rb' - 'spec/services/jobseekers/job_applications/prefill_job_application_from_previous_application_spec.rb' - 'spec/services/search/school_search_spec.rb' - 'spec/services/search/vacancy_search_spec.rb' @@ -707,7 +702,7 @@ RSpec/ImplicitSubject: - 'spec/form_models/jobseekers/unsubscribe_feedback_form_spec.rb' - 'spec/form_models/publishers/job_listing/feedback_form_spec.rb' -# Offense count: 186 +# Offense count: 184 # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns. RSpec/IndexedLet: Exclude: @@ -735,7 +730,6 @@ RSpec/IndexedLet: - 'spec/system/jobseekers/jobseekers_can_manage_their_saved_jobs_spec.rb' - 'spec/system/jobseekers/jobseekers_can_search_for_jobs_spec.rb' - 'spec/system/jobseekers/jobseekers_can_search_for_schools_spec.rb' - - 'spec/system/jobseekers/jobseekers_can_view_campaign_landing_pages_spec.rb' - 'spec/system/jobseekers/prefilling_applications_spec.rb' - 'spec/system/publishers/publishers_can_edit_a_published_vacancy_as_a_school_group_spec.rb' - 'spec/system/publishers/publishers_can_filter_vacancies_in_their_dashboard_spec.rb' @@ -797,7 +791,7 @@ RSpec/LetBeforeExamples: Exclude: - 'spec/system/jobseekers/jobseekers_can_apply_for_a_vacancy_spec.rb' -# Offense count: 122 +# Offense count: 121 RSpec/LetSetup: Exclude: - 'spec/components/dashboard_component_spec.rb' @@ -826,7 +820,6 @@ RSpec/LetSetup: - 'spec/services/vacancies/import/sources/ark_spec.rb' - 'spec/services/vacancies/import/sources/broadbean_spec.rb' - 'spec/services/vacancies/import/sources/united_learning_spec.rb' - - 'spec/services/vacancies/import/sources/ventrus_spec.rb' - 'spec/system/jobseekers/jobseeker_applications_statuses_spec.rb' - 'spec/system/jobseekers/jobseeker_can_add_training_and_cpds_to_their_job_application_spec.rb' - 'spec/system/jobseekers/jobseekers_can_add_employments_to_their_job_application_spec.rb' @@ -905,7 +898,7 @@ RSpec/MetadataStyle: - 'spec/system/publishers/publishers_can_add_notes_to_a_job_application_spec.rb' - 'spec/system/publishers/publishers_can_view_vacancy_activity_log_spec.rb' -# Offense count: 896 +# Offense count: 882 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # SupportedStyles: always, named_only RSpec/NamedSubject: @@ -965,8 +958,6 @@ RSpec/NamedSubject: - 'spec/requests/vacancies_spec.rb' - 'spec/services/ab_tests_spec.rb' - 'spec/services/authorisation_spec.rb' - - 'spec/services/campaign_page_spec.rb' - - 'spec/services/campaign_search_params_merger_spec.rb' - 'spec/services/gias/import_schools_and_local_authorities_spec.rb' - 'spec/services/gias/import_trusts_spec.rb' - 'spec/services/image_manipulator_spec.rb' @@ -1023,7 +1014,6 @@ RSpec/NamedSubject: - 'spec/services/vacancies/import/sources/vacancy_poster_spec.rb' - 'spec/services/vacancies/import/sources/ventrus_spec.rb' - 'spec/services/zendesk_spec.rb' - - 'spec/validators/form_file_validator_spec.rb' # Offense count: 5 # Configuration parameters: AllowedPatterns. @@ -1033,7 +1023,7 @@ RSpec/NoExpectationExample: - 'spec/jobs/send_email_for_draft_job_applications_job_spec.rb' - 'spec/jobs/send_email_for_unapplied_saved_vacancies_job_spec.rb' -# Offense count: 91 +# Offense count: 90 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: not_to, to_not @@ -1114,12 +1104,11 @@ RSpec/RepeatedExampleGroupBody: - 'spec/system/jobseekers/jobseekers_can_search_for_jobs_spec.rb' - 'spec/system/publishers/publishers_can_preview_a_vacancy_spec.rb' -# Offense count: 13 +# Offense count: 11 RSpec/RepeatedExampleGroupDescription: Exclude: - 'spec/concerns/reset_vacancies_in_job_listings_spec.rb' - 'spec/form_models/jobseekers/job_preferences_form_spec.rb' - - 'spec/form_models/jobseekers/profiles/employment_form_spec.rb' - 'spec/helpers/profiles_helper_spec.rb' - 'spec/lib/dfe_sign_in/api/request_spec.rb' - 'spec/services/search/vacancy_sort_spec.rb' @@ -1164,7 +1153,7 @@ RSpec/SortMetadata: Exclude: - 'spec/rails_helper.rb' -# Offense count: 14 +# Offense count: 13 # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. # Include: **/*_spec.rb RSpec/SpecFilePathFormat: @@ -1182,7 +1171,6 @@ RSpec/SpecFilePathFormat: - 'spec/services/publishers/dfe_sign_in/update_dsi_users_in_db_spec.rb' - 'spec/services/vacancies/export/dwp_find_a_job/published_and_updated_vacancies/parsed_vacancy_spec.rb' - 'spec/services/vacancies/export/dwp_find_a_job/published_and_updated_vacancies/query_spec.rb' - - 'spec/services/vacancies/import/sources/vacancy_poster_spec.rb' # Offense count: 80 RSpec/StubbedMock: @@ -1226,14 +1214,13 @@ RSpec/StubbedMock: - 'spec/system/jobseekers/jobseekers_can_create_a_job_alert_from_a_search_spec.rb' - 'spec/system/jobseekers/jobseekers_can_manage_their_job_alerts_from_the_email_spec.rb' -# Offense count: 4 +# Offense count: 2 RSpec/SubjectDeclaration: Exclude: - 'spec/components/searchable_collection_component_spec.rb' - 'spec/services/zendesk_spec.rb' - - 'spec/validators/form_file_validator_spec.rb' -# Offense count: 26 +# Offense count: 24 RSpec/SubjectStub: Exclude: - 'spec/components/vacancy_form_page_heading_component_spec.rb' @@ -1247,24 +1234,8 @@ RSpec/SubjectStub: - 'spec/services/location_suggestion_spec.rb' - 'spec/services/search/vacancy_search_spec.rb' - 'spec/services/vacancies/export/dwp_find_a_job/published_and_updated_vacancies/parsed_vacancy_spec.rb' - - 'spec/validators/form_file_validator_spec.rb' -# Offense count: 14 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: constant, string -RSpec/VerifiedDoubleReference: - Exclude: - - 'spec/helpers/profiles_helper_spec.rb' - - 'spec/jobs/import_organisation_data_job_spec.rb' - - 'spec/jobs/seed_database_job_spec.rb' - - 'spec/lib/dfe_sign_in/api/response_spec.rb' - - 'spec/services/authorisation_spec.rb' - - 'spec/services/publishers/dfe_sign_in/big_query_export/approvers_spec.rb' - - 'spec/services/publishers/dfe_sign_in/big_query_export/users_spec.rb' - - 'spec/system/publishers/publishers_can_view_vacancy_statistics_spec.rb' - -# Offense count: 88 +# Offense count: 83 # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. RSpec/VerifiedDoubles: Exclude: @@ -1305,7 +1276,6 @@ RSpec/VerifiedDoubles: - 'spec/services/vacancies/import/sources/every_spec.rb' - 'spec/services/vacancies/import/sources/fusion_spec.rb' - 'spec/services/vacancies/import/sources/my_new_term_spec.rb' - - 'spec/services/vacancies/import/sources/vacancy_poster_spec.rb' - 'spec/services/vacancies/import/sources/ventrus_spec.rb' - 'spec/services/zendesk_spec.rb' - 'spec/system/jobseekers/jobseekers_can_create_a_job_alert_from_a_search_spec.rb' @@ -1325,7 +1295,7 @@ RSpecRails/HaveHttpStatus: - 'spec/requests/redirect_to_canonical_domain_spec.rb' - 'spec/requests/support_users/fallback_sessions_spec.rb' -# Offense count: 10 +# Offense count: 9 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Inferences. RSpecRails/InferredSpecType: @@ -1385,14 +1355,13 @@ Rails/ApplicationRecord: Exclude: - 'app/models/failed_imported_vacancy.rb' -# Offense count: 20 +# Offense count: 17 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent. Rails/Blank: Exclude: - 'app/components/editor_component.rb' - 'app/controllers/jobseekers/job_applications_controller.rb' - - 'app/controllers/jobseekers/registrations_controller.rb' - 'app/helpers/dates_helper.rb' - 'app/helpers/job_applications_helper.rb' - 'app/helpers/pdf_helper.rb' @@ -1415,7 +1384,7 @@ Rails/CompactBlank: - 'app/services/search/criteria_inventor.rb' - 'app/services/zendesk.rb' -# Offense count: 48 +# Offense count: 47 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle, AllowToTime. # SupportedStyles: strict, flexible @@ -1531,14 +1500,6 @@ Rails/IndexWith: Exclude: - 'app/services/ab_tests.rb' -# Offense count: 6 -# Configuration parameters: Include. -# Include: app/controllers/**/*.rb, app/mailers/**/*.rb -Rails/LexicallyScopedActionFilter: - Exclude: - - 'app/controllers/jobseekers/registrations_controller.rb' - - 'app/controllers/publishers/candidate_profiles_interstitials_controller.rb' - # Offense count: 6 # This cop supports unsafe autocorrection (--autocorrect-all). Rails/Pluck: @@ -1628,7 +1589,7 @@ Rails/RootPathnameMethods: - 'spec/lib/dfe_sign_in/api_spec.rb' - 'spec/support/auth_helpers.rb' -# Offense count: 182 +# Offense count: 181 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowImplicitReturn, AllowedReceivers. Rails/SaveBang: @@ -1823,7 +1784,7 @@ Style/DateTime: - 'spec/system/publishers/publishers_are_reminded_of_application_functionality_spec.rb' - 'spec/system/publishers/publishers_can_extend_a_deadline_spec.rb' -# Offense count: 298 +# Offense count: 270 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, MinSize, WordRegex. # SupportedStyles: percent, brackets @@ -1835,7 +1796,6 @@ Style/WordArray: - 'app/helpers/guiding_pages_helper.rb' - 'app/models/concerns/resettable.rb' - 'app/queries/vacancy_filter_query.rb' - - 'app/services/campaign_search_params_merger.rb' - 'config/initializers/rack_attack.rb' - 'config/routes.rb' - 'db/seeds.rb' @@ -1853,8 +1813,6 @@ Style/WordArray: - 'spec/requests/publishers/vacancies/build_spec.rb' - 'spec/requests/subscriptions_spec.rb' - 'spec/services/authorisation_spec.rb' - - 'spec/services/campaign_page_spec.rb' - - 'spec/services/campaign_search_params_merger_spec.rb' - 'spec/services/dsi_client_spec.rb' - 'spec/services/jobseekers/job_applications/job_application_step_process_spec.rb' - 'spec/services/jobseekers/job_applications/prefill_job_application_from_previous_application_spec.rb' @@ -1869,16 +1827,13 @@ Style/WordArray: - 'spec/services/vacancies/import/sources/ark_spec.rb' - 'spec/services/vacancies/import/sources/broadbean_spec.rb' - 'spec/services/vacancies/import/sources/every_spec.rb' - - 'spec/services/vacancies/import/sources/fusion_spec.rb' - 'spec/services/vacancies/import/sources/my_new_term_spec.rb' - 'spec/services/vacancies/import/sources/united_learning_spec.rb' - - 'spec/services/vacancies/import/sources/vacancy_poster_spec.rb' - 'spec/services/vacancies/import/sources/ventrus_spec.rb' - 'spec/system/jobseekers/jobseekers_can_complete_a_job_application_spec.rb' - 'spec/system/jobseekers/jobseekers_can_create_a_job_alert_from_a_listing_spec.rb' - 'spec/system/jobseekers/jobseekers_can_search_for_jobs_spec.rb' - 'spec/system/jobseekers/jobseekers_can_view_a_job_application_spec.rb' - - 'spec/system/jobseekers/jobseekers_can_view_campaign_landing_pages_spec.rb' - 'spec/system/publishers/publishers_can_add_aditional_documents_to_a_vacancy_spec.rb' - 'spec/system/publishers/publishers_can_edit_a_draft_vacancy_spec.rb' - 'spec/system/publishers/publishers_can_edit_a_published_vacancy_as_a_school_group_spec.rb' diff --git a/app/components/job_application_review_component.rb b/app/components/job_application_review_component.rb index d113420c9f..79a02e2a1b 100644 --- a/app/components/job_application_review_component.rb +++ b/app/components/job_application_review_component.rb @@ -1,4 +1,11 @@ -class JobApplicationReviewComponent < ReviewComponent +class JobApplicationReviewComponent < ApplicationComponent + renders_one :header + + renders_one :above + renders_one :below + + renders_one :sidebar, ReviewComponent::Sidebar + renders_many(:sections, lambda do |section_name, **kwargs| JobApplicationReviewComponent::Section.new( @job_application, @@ -10,25 +17,22 @@ class JobApplicationReviewComponent < ReviewComponent attr_reader :job_application - def initialize(job_application, step_process:, allow_edit: nil, classes: [], html_attributes: {}, **) + def initialize(job_application, show_sidebar: true, allow_edit: nil, classes: [], html_attributes: {}) super( classes: classes, html_attributes: html_attributes, - namespace: "jobseekers/job_applications", - **, ) @allow_edit = allow_edit @job_application = job_application - @step_process = step_process + @show_sidebar = show_sidebar end - private + def column_class + show_sidebar? ? %w[govuk-grid-column-two-thirds] : %w[govuk-grid-column-full] + end - def track_assigns - super.merge( - job_application: @job_application, - step_process: @step_process, - ) + def show_sidebar? + !!@show_sidebar end end diff --git a/app/components/review_component/review_component.html.slim b/app/components/job_application_review_component/job_application_review_component.html.slim similarity index 94% rename from app/components/review_component/review_component.html.slim rename to app/components/job_application_review_component/job_application_review_component.html.slim index 42eb0e508b..ae91b91b33 100644 --- a/app/components/review_component/review_component.html.slim +++ b/app/components/job_application_review_component/job_application_review_component.html.slim @@ -10,6 +10,8 @@ - sections.each do |section| = section + = content + = below - if show_sidebar? diff --git a/app/components/job_application_review_component/section.rb b/app/components/job_application_review_component/section.rb index 596476ffc4..3ad48efd79 100644 --- a/app/components/job_application_review_component/section.rb +++ b/app/components/job_application_review_component/section.rb @@ -2,13 +2,14 @@ class JobApplicationReviewComponent::Section < ReviewComponent::Section include JobApplicationsHelper include VacanciesHelper - def initialize(job_application, allow_edit: nil, forms: [], classes: [], html_attributes: {}, **) + def initialize(job_application, name:, id: nil, allow_edit: nil, forms: [], classes: [], html_attributes: {}) super( job_application, forms: forms, + name: name, + id: id, classes: classes, - html_attributes: html_attributes, - **, + html_attributes: html_attributes ) @allow_edit = allow_edit @@ -21,10 +22,11 @@ def heading_text t("jobseekers.job_applications.build.#{@name}.heading") end - def build_list - list = nil - govuk_summary_list { |l| list = l } - list + def edit_link + title = heading_text + text = "Change" + href = error_path + govuk_link_to text, href, aria: { label: "#{text} #{title}" }, classes: "govuk-!-display-none-print" if text && href end def constantize_form(form_class_name) diff --git a/app/components/review_component.rb b/app/components/review_component.rb deleted file mode 100644 index 30f6e07a3e..0000000000 --- a/app/components/review_component.rb +++ /dev/null @@ -1,52 +0,0 @@ -# This is an abstract class. See VacancyReviewComponent or -# JobApplicationReviewComponent for specific implementations. -class ReviewComponent < ApplicationComponent - renders_one :header - - renders_one :above - renders_one :below - - renders_one :sidebar, ReviewComponent::Sidebar - - def initialize(namespace:, show_tracks:, show_sidebar: true, classes: [], html_attributes: {}) - super(classes: classes, html_attributes: html_attributes) - - @namespace = namespace - @show_tracks = show_tracks - @show_sidebar = show_sidebar - end - - def before_render - return unless show_tracks? - - with_sidebar do - render("#{namespace}/build/steps", track_assigns) - end - end - - def column_class - show_sidebar? || show_tracks? ? %w[govuk-grid-column-two-thirds] : %w[govuk-grid-column-full] - end - - private - - def default_classes - %w[review-component] - end - - attr_reader(*%I[ - namespace - ]) - - def show_tracks? - !!@show_tracks - end - - def show_sidebar? - !!@show_sidebar - end - - def track_assigns - {} - end -end diff --git a/app/components/review_component/section.rb b/app/components/review_component/section.rb index 2818531765..8484503646 100644 --- a/app/components/review_component/section.rb +++ b/app/components/review_component/section.rb @@ -1,13 +1,24 @@ -# This is an abstract class. See VacancyReviewComponent::Section or -# JobApplicationReviewComponent::Section for specific implementations. +# This is an abstract class. +# See JobApplicationReviewComponent::Section for specific implementation. class ReviewComponent::Section < ApplicationComponent include FormsHelper include StatusTagHelper - renders_one :heading, ReviewComponent::Section::Heading renders_many :field_div_sets, ->(f = nil, form: nil) { render_divs_for_fields(f || form) } - delegate :with_row, to: :@list + class RowData + attr_reader :key, :value + + def with_key(text:) + @key = text + end + + def with_value(text:) + @value = text + end + end + + attr_reader :rows def initialize(record, name:, id: nil, forms: [], **) super(**) @@ -18,30 +29,19 @@ def initialize(record, name:, id: nil, forms: [], **) @id = id || name @name = name @record = record + @rows = [] + end + + def with_row + row_data = RowData.new + yield(row_data) if block_given? + @rows << row_data end private def before_render with_field_div_sets(@forms.map { |f| { form: f } }) - - with_heading(title: heading_text, link_to: [error_link_text, error_path], allow_edit: allow_edit?) do - review_section_tag(@record, @forms.map(&:target_name), @forms) - end - - @list = build_list - end - - def content - # Calling `super` here has side-effects which - # affect the contents of `@list.rows`. - super_content = super - - if @list.rows.any? - render(@list) - else - super_content - end end attr_reader :id diff --git a/app/components/review_component/section/heading.rb b/app/components/review_component/section/heading.rb deleted file mode 100644 index b540aa7ebc..0000000000 --- a/app/components/review_component/section/heading.rb +++ /dev/null @@ -1,25 +0,0 @@ -class ReviewComponent::Section::Heading < ApplicationComponent - def initialize(title:, link_to: [], allow_edit: true, classes: [], html_attributes: {}) - super(classes: classes, html_attributes: html_attributes) - - @title = title - @text, @href = link_to - @allow_edit = allow_edit - end - - private - - attr_reader :title, :text, :href - - def default_classes - %w[review-component__section__heading] - end - - def edit_link - govuk_link_to text, href, aria: { label: "#{text} #{title}" }, classes: "govuk-!-display-none-print" if text && href - end - - def allow_edit? - !!@allow_edit - end -end diff --git a/app/components/review_component/section/heading/heading.html.slim b/app/components/review_component/section/heading/heading.html.slim deleted file mode 100644 index b192b2bbce..0000000000 --- a/app/components/review_component/section/heading/heading.html.slim +++ /dev/null @@ -1,5 +0,0 @@ -= tag.div(**html_attributes) - .review-component__section__heading__title - h3.govuk-heading-m = title - = edit_link if allow_edit? - .review-component__section__heading__status = content if allow_edit? diff --git a/app/components/review_component/section/section.html.slim b/app/components/review_component/section/section.html.slim index dc47e1b8fa..6ac9be73d8 100644 --- a/app/components/review_component/section/section.html.slim +++ b/app/components/review_component/section/section.html.slim @@ -3,6 +3,14 @@ li = field_div_set = tag.div(id: id, **html_attributes) do - = heading .review-component__section__body - = content + = govuk_summary_card(title: heading_text) do |card| + - card.with_action { edit_link } + - if rows.any? + - card.with_summary_list do |summary_list| + - rows.each do |row_data| + - summary_list.with_row do |row| + - row.with_key text: row_data.key if row_data.key.present? + - row.with_value text: row_data.value if row_data.value.present? + - else + = content diff --git a/app/controllers/jobseekers/job_applications/build_controller.rb b/app/controllers/jobseekers/job_applications/build_controller.rb index 81188b35cc..d969118cb8 100644 --- a/app/controllers/jobseekers/job_applications/build_controller.rb +++ b/app/controllers/jobseekers/job_applications/build_controller.rb @@ -1,16 +1,10 @@ class Jobseekers::JobApplications::BuildController < Jobseekers::JobApplications::BaseController - include Wicked::Wizard include Jobseekers::QualificationFormConcerns - steps :personal_details, :professional_status, :qualifications, :training_and_cpds, :employment_history, :personal_statement, :references, - :equal_opportunities, :ask_for_support, :declarations - helper_method :back_path, :employments, :form, :job_application, :qualification_form_param_key, :redirect_to_review?, :vacancy def show - skip_step_if_missing - - render_wizard + render step end def update @@ -18,11 +12,13 @@ def update job_application.update(update_params.except(:teacher_reference_number, :has_teacher_reference_number)) update_or_create_jobseeker_profile! if step == :professional_status - return redirect_to finish_wizard_path, success: t("messages.jobseekers.job_applications.saved") if redirect_to_review? - - render_wizard job_application + if redirect_to_review? + redirect_to jobseekers_job_application_review_path(job_application), success: t("messages.jobseekers.job_applications.saved") + else + redirect_to jobseekers_job_application_apply_path job_application + end else - render_wizard + render step end end @@ -30,11 +26,9 @@ def update def back_path @back_path ||= if redirect_to_review? - finish_wizard_path - elsif step == :personal_details - new_jobseekers_job_job_application_path(vacancy.id) + jobseekers_job_application_review_path(job_application) else - jobseekers_job_application_build_path(job_application.id, step_process.previous_step) + jobseekers_job_application_apply_path job_application end end @@ -42,6 +36,10 @@ def form @form ||= form_class.new(form_attributes) end + def step + params[:id].to_sym + end + def form_class "jobseekers/job_application/#{step}_form".camelize.constantize end @@ -49,7 +47,7 @@ def form_class def form_attributes attributes = case action_name when "show" - form_class.load(job_application.attributes) + form_class.load_form(job_application) when "update" form_params end @@ -83,7 +81,7 @@ def job_application end def redirect_to_review? - current_jobseeker.job_applications.not_draft.any? || session[:back_to_review]&.include?(job_application.id) + session[:back_to_review]&.include?(job_application.id) end def update_params @@ -105,8 +103,6 @@ def update_fields end def step_incomplete? - return false unless step.in? %i[qualifications employment_history training_and_cpds] - form_params["#{step}_section_completed"] == "false" end @@ -114,13 +110,6 @@ def vacancy @vacancy ||= job_application.vacancy end - def skip_step_if_missing - # Calling step_process will initialize a StepProcess, which will raise if the current step is missing. - step_process - rescue StepProcess::MissingStepError - skip_step unless step == "wicked_finish" - end - def jobseeker_profile_attributes { jobseeker_profile: current_jobseeker.jobseeker_profile, diff --git a/app/controllers/jobseekers/job_applications_controller.rb b/app/controllers/jobseekers/job_applications_controller.rb index 87b513e16d..8e121ff3b7 100644 --- a/app/controllers/jobseekers/job_applications_controller.rb +++ b/app/controllers/jobseekers/job_applications_controller.rb @@ -1,6 +1,8 @@ +# rubocop:disable Metrics/ClassLength class Jobseekers::JobApplicationsController < Jobseekers::JobApplications::BaseController include Jobseekers::QualificationFormConcerns + before_action :set_job_application, only: %i[review apply pre_submit submit show confirm_destroy destroy confirm_withdraw withdraw] before_action :raise_unless_vacancy_enable_job_applications, :redirect_if_job_application_exists, only: %i[new create new_quick_apply quick_apply] before_action :redirect_unless_draft_job_application, only: %i[review] @@ -25,7 +27,15 @@ def new def create new_job_application = current_jobseeker.job_applications.create(vacancy:) - redirect_to jobseekers_job_application_build_path(new_job_application, :personal_details) + redirect_to jobseekers_job_application_apply_path(new_job_application) + end + + def pre_submit + if all_steps_valid? + redirect_to jobseekers_job_application_review_path(@job_application) + else + render :apply + end end def review @@ -48,12 +58,14 @@ def new_quick_apply raise ActionController::RoutingError, "Cannot quick apply if there's no profile or non-draft applications" unless quick_apply? end + def apply; end + def quick_apply raise ActionController::RoutingError, "Cannot quick apply if there's no profile or non-draft applications" unless quick_apply? new_job_application = prefill_job_application_with_available_data - redirect_to jobseekers_job_application_review_path(new_job_application), notice: t("jobseekers.job_applications.new_quick_apply.import_from_previous_application") + redirect_to jobseekers_job_application_apply_path(new_job_application), notice: t("jobseekers.job_applications.new_quick_apply.import_from_previous_application") end def submit @@ -104,6 +116,8 @@ def withdraw private + attr_reader :job_application + def prefill_job_application_with_available_data Jobseekers::JobApplications::QuickApply.new(current_jobseeker, vacancy).job_application end @@ -126,7 +140,7 @@ def all_steps_valid? def step_valid?(step) step_form = "jobseekers/job_application/#{step}_form".camelize.constantize - attributes = step_form.load(job_application.attributes) + attributes = step_form.load_form(job_application) attributes.merge!(trn_params) if step == :professional_status form = step_form.new(attributes) @@ -140,8 +154,8 @@ def employments @employments ||= job_application.employments.order(:started_on) end - def job_application - @job_application ||= current_jobseeker.job_applications.find(params[:job_application_id] || params[:id]) + def set_job_application + @job_application = current_jobseeker.job_applications.find(params[:job_application_id] || params[:id]) end def redirect_if_job_application_exists @@ -240,3 +254,4 @@ def trn_params } end end +# rubocop:enable Metrics/ClassLength diff --git a/app/form_models/jobseekers/job_application/ask_for_support_form.rb b/app/form_models/jobseekers/job_application/ask_for_support_form.rb index d0ef11c20e..541b8bd868 100644 --- a/app/form_models/jobseekers/job_application/ask_for_support_form.rb +++ b/app/form_models/jobseekers/job_application/ask_for_support_form.rb @@ -1,11 +1,31 @@ -class Jobseekers::JobApplication::AskForSupportForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model +module Jobseekers + module JobApplication + class AskForSupportForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - def self.fields - %i[support_needed support_needed_details] - end - attr_accessor(*fields) + FIELDS = %i[support_needed support_needed_details].freeze + + class << self + def storable_fields + FIELDS + end + + def unstorable_fields + %i[ask_for_support_section_completed] + end - validates :support_needed, inclusion: { in: %w[yes no] } - validates :support_needed_details, presence: true, if: -> { support_needed == "yes" } + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :ask_for_support))) + end + end + attr_accessor(*FIELDS) + + validates :support_needed, inclusion: { in: %w[yes no] }, if: -> { ask_for_support_section_completed } + validates :support_needed_details, presence: true, if: -> { support_needed == "yes" && ask_for_support_section_completed } + + completed_attribute(:ask_for_support) + end + end end diff --git a/app/form_models/jobseekers/job_application/base_form.rb b/app/form_models/jobseekers/job_application/base_form.rb index 12a3ad44f5..c5b26c818a 100644 --- a/app/form_models/jobseekers/job_application/base_form.rb +++ b/app/form_models/jobseekers/job_application/base_form.rb @@ -1,19 +1,27 @@ -class Jobseekers::JobApplication::BaseForm < BaseForm - def self.fields - [] - end +module Jobseekers + module JobApplication + class BaseForm < ::BaseForm + class << self + def fields + storable_fields + unstorable_fields + end - def self.unstorable_fields - [] - end + def unstorable_fields + [] + end - def self.storable_fields - fields - unstorable_fields - end + def storable_fields + [] + end + + def load_form(model) + load_form_attributes(model.attributes) + end - class << self - def load(attrs) - attrs.symbolize_keys.slice(*fields) + def load_form_attributes(attrs) + attrs.symbolize_keys.slice(*fields) + end + end end end end diff --git a/app/form_models/jobseekers/job_application/completed_form_attribute.rb b/app/form_models/jobseekers/job_application/completed_form_attribute.rb new file mode 100644 index 0000000000..e7c0125a90 --- /dev/null +++ b/app/form_models/jobseekers/job_application/completed_form_attribute.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Jobseekers + module JobApplication + module CompletedFormAttribute + extend ActiveSupport::Concern + + class_methods do + def completed_attrs(model, section) + section_completed = :"#{section}_section_completed" + {}.tap do |new_attrs| + if model.completed_steps.include?(section.to_s) + new_attrs.merge!(section_completed => true) + elsif model.in_progress_steps.include?(section.to_s) + new_attrs.merge!(section_completed => false) + end + end + end + + def completed_attribute(section) + section_completed = :"#{section}_section_completed" + + attribute section_completed, :boolean + + validates section_completed, inclusion: { in: [true, false], allow_nil: false } + end + end + end + end +end diff --git a/app/form_models/jobseekers/job_application/declarations_form.rb b/app/form_models/jobseekers/job_application/declarations_form.rb index a100c24244..69659f55eb 100644 --- a/app/form_models/jobseekers/job_application/declarations_form.rb +++ b/app/form_models/jobseekers/job_application/declarations_form.rb @@ -1,13 +1,33 @@ -class Jobseekers::JobApplication::DeclarationsForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model +module Jobseekers + module JobApplication + class DeclarationsForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - def self.fields - %i[close_relationships close_relationships_details right_to_work_in_uk safeguarding_issue safeguarding_issue_details] - end - attr_accessor(*fields) + FIELDS = %i[close_relationships close_relationships_details right_to_work_in_uk safeguarding_issue safeguarding_issue_details].freeze + + class << self + def storable_fields + FIELDS + end + + def unstorable_fields + %i[declarations_section_completed] + end - validates :close_relationships, inclusion: { in: %w[yes no] } - validates :close_relationships_details, presence: true, if: -> { close_relationships == "yes" } - validates :safeguarding_issue, inclusion: { in: %w[yes no] } - validates :safeguarding_issue_details, presence: true, if: -> { safeguarding_issue == "yes" } + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :declarations))) + end + end + attr_accessor(*FIELDS) + + validates :close_relationships, inclusion: { in: %w[yes no] }, if: -> { declarations_section_completed } + validates :close_relationships_details, presence: true, if: -> { close_relationships == "yes" && declarations_section_completed } + validates :safeguarding_issue, inclusion: { in: %w[yes no] }, if: -> { declarations_section_completed } + validates :safeguarding_issue_details, presence: true, if: -> { safeguarding_issue == "yes" && declarations_section_completed } + + completed_attribute(:declarations) + end + end end diff --git a/app/form_models/jobseekers/job_application/employment_history_form.rb b/app/form_models/jobseekers/job_application/employment_history_form.rb index 8b87fc95f8..2ed93ebc28 100644 --- a/app/form_models/jobseekers/job_application/employment_history_form.rb +++ b/app/form_models/jobseekers/job_application/employment_history_form.rb @@ -1,25 +1,40 @@ -class Jobseekers::JobApplication::EmploymentHistoryForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model - include ActionView::Helpers::DateHelper +module Jobseekers + module JobApplication + class EmploymentHistoryForm < BaseForm + include ActiveModel::Model + include ActionView::Helpers::DateHelper + include ActiveModel::Attributes + include CompletedFormAttribute - def self.fields - %i[employment_history_section_completed unexplained_employment_gaps_present] - end - attr_accessor(*fields, :unexplained_employment_gaps) + FIELDS = %i[unexplained_employment_gaps_present].freeze - validates :employment_history_section_completed, presence: true - validate :employment_history_gaps_are_explained + class << self + def storable_fields + [] + end - def employment_history_gaps_are_explained - return unless unexplained_employment_gaps_present == "true" && employment_history_section_completed == "true" + def unstorable_fields + %i[unexplained_employment_gaps_present employment_history_section_completed] + end - unexplained_employment_gaps.each_value do |details| - gap_duration = distance_of_time_in_words(details[:started_on], details[:ended_on] || Time.zone.today) - errors.add(:base, "You have a gap in your work history (#{gap_duration}).") - end - end + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :employment_history))) + end + end + attr_accessor(*FIELDS, :unexplained_employment_gaps) + + validate :employment_history_gaps_are_explained - def self.unstorable_fields - %i[unexplained_employment_gaps unexplained_employment_gaps_present] + def employment_history_gaps_are_explained + return unless unexplained_employment_gaps_present == "true" && employment_history_section_completed + + unexplained_employment_gaps.each_value do |details| + gap_duration = distance_of_time_in_words(details[:started_on], details[:ended_on] || Time.zone.today) + errors.add(:base, "You have a gap in your work history (#{gap_duration}).") + end + end + + completed_attribute(:employment_history) + end end end diff --git a/app/form_models/jobseekers/job_application/equal_opportunities_form.rb b/app/form_models/jobseekers/job_application/equal_opportunities_form.rb index 4be502195b..7cb0f0b499 100644 --- a/app/form_models/jobseekers/job_application/equal_opportunities_form.rb +++ b/app/form_models/jobseekers/job_application/equal_opportunities_form.rb @@ -1,15 +1,35 @@ -class Jobseekers::JobApplication::EqualOpportunitiesForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model +module Jobseekers + module JobApplication + class EqualOpportunitiesForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - def self.fields - %i[disability age gender gender_description orientation orientation_description ethnicity ethnicity_description religion religion_description] + FIELDS = %i[disability age gender gender_description orientation orientation_description ethnicity ethnicity_description religion religion_description].freeze + + class << self + def storable_fields + FIELDS + end + + def unstorable_fields + %i[equal_opportunities_section_completed] + end + + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :equal_opportunities))) + end + end + attr_accessor(*FIELDS) + + validates :disability, inclusion: { in: %w[no prefer_not_to_say yes] }, if: -> { equal_opportunities_section_completed } + validates :age, inclusion: { in: %w[under_twenty_five twenty_five_to_twenty_nine thirty_to_thirty_nine forty_to_forty_nine fifty_to_fifty_nine sixty_and_over prefer_not_to_say] }, if: -> { equal_opportunities_section_completed } + validates :gender, inclusion: { in: %w[man other prefer_not_to_say woman] }, if: -> { equal_opportunities_section_completed } + validates :orientation, inclusion: { in: %w[bisexual gay_or_lesbian heterosexual other prefer_not_to_say] }, if: -> { equal_opportunities_section_completed } + validates :ethnicity, inclusion: { in: %w[asian black mixed other prefer_not_to_say white] }, if: -> { equal_opportunities_section_completed } + validates :religion, inclusion: { in: %w[buddhist christian hindu jewish muslim none other prefer_not_to_say sikh] }, if: -> { equal_opportunities_section_completed } + + completed_attribute(:equal_opportunities) + end end - attr_accessor(*fields) - - validates :disability, inclusion: { in: %w[no prefer_not_to_say yes] } - validates :age, inclusion: { in: %w[under_twenty_five twenty_five_to_twenty_nine thirty_to_thirty_nine forty_to_forty_nine fifty_to_fifty_nine sixty_and_over prefer_not_to_say] } - validates :gender, inclusion: { in: %w[man other prefer_not_to_say woman] } - validates :orientation, inclusion: { in: %w[bisexual gay_or_lesbian heterosexual other prefer_not_to_say] } - validates :ethnicity, inclusion: { in: %w[asian black mixed other prefer_not_to_say white] } - validates :religion, inclusion: { in: %w[buddhist christian hindu jewish muslim none other prefer_not_to_say sikh] } end diff --git a/app/form_models/jobseekers/job_application/personal_details_form.rb b/app/form_models/jobseekers/job_application/personal_details_form.rb index b36ed44216..d6b2449bc7 100644 --- a/app/form_models/jobseekers/job_application/personal_details_form.rb +++ b/app/form_models/jobseekers/job_application/personal_details_form.rb @@ -1,46 +1,58 @@ -class Jobseekers::JobApplication::PersonalDetailsForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model - - def self.fields - %i[ - city country - email_address - first_name - last_name - national_insurance_number - phone_number - previous_names - postcode - street_address - right_to_work_in_uk - has_ni_number - ] - end - attr_accessor(*(fields - [:national_insurance_number])) - attr_writer :national_insurance_number +module Jobseekers + module JobApplication + class PersonalDetailsForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - class << self - def unstorable_fields - %i[has_ni_number] - end + FIELDS = %i[ + city country + email_address + first_name + last_name + phone_number + previous_names + postcode + street_address + right_to_work_in_uk + ].freeze - def load(attrs) - super(attrs.except(:has_ni_number)).merge(has_ni_number: attrs[:national_insurance_number].present? ? "yes" : "no") - end - end + attr_accessor(*(FIELDS + [:has_ni_number])) + attr_writer :national_insurance_number - def national_insurance_number - @national_insurance_number if has_ni_number == "yes" - end + def national_insurance_number + @national_insurance_number if has_ni_number == "yes" + end + + class << self + def storable_fields + FIELDS + %i[national_insurance_number] + end - validates :city, :country, :email_address, :first_name, :last_name, - :phone_number, :postcode, :street_address, presence: true + def unstorable_fields + %i[has_ni_number personal_details_section_completed] + end - validates :national_insurance_number, format: { with: /\A\s*[a-zA-Z]{2}(?:\s*\d\s*){6}[a-zA-Z]?\s*\z/ }, allow_blank: true - validates :has_ni_number, inclusion: { in: %w[yes no], allow_nil: false } - validates :national_insurance_number, presence: true, if: -> { has_ni_number == "yes" } + def load_form(model) + new_attrs = { + has_ni_number: model.national_insurance_number.present? ? "yes" : "no", + }.merge(completed_attrs(model, :personal_details)) + load_form_attributes(model.attributes.merge(new_attrs)) + end + end - validates :phone_number, format: { with: /\A\+?(?:\d\s?){10,13}\z/ } - validates :email_address, email_address: true - validates :right_to_work_in_uk, inclusion: { in: %w[yes no] } + validates :city, :country, :email_address, :first_name, :last_name, + :phone_number, :postcode, :street_address, presence: true, if: -> { personal_details_section_completed } + + validates :national_insurance_number, format: { with: /\A\s*[a-zA-Z]{2}(?:\s*\d\s*){6}[a-zA-Z]?\s*\z/ }, allow_blank: true + validates :has_ni_number, inclusion: { in: %w[yes no], allow_nil: false }, if: -> { personal_details_section_completed } + validates :national_insurance_number, presence: true, if: -> { has_ni_number == "yes" } + + validates :phone_number, format: { with: /\A\+?(?:\d\s?){10,13}\z/ }, if: -> { personal_details_section_completed } + validates :email_address, email_address: true + validates :right_to_work_in_uk, inclusion: { in: %w[yes no] }, if: -> { personal_details_section_completed } + + completed_attribute(:personal_details) + end + end end diff --git a/app/form_models/jobseekers/job_application/personal_statement_form.rb b/app/form_models/jobseekers/job_application/personal_statement_form.rb index 56c964ee9d..76c4f2f4d1 100644 --- a/app/form_models/jobseekers/job_application/personal_statement_form.rb +++ b/app/form_models/jobseekers/job_application/personal_statement_form.rb @@ -1,10 +1,30 @@ -class Jobseekers::JobApplication::PersonalStatementForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model +module Jobseekers + module JobApplication + class PersonalStatementForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - def self.fields - %i[personal_statement] - end - attr_accessor(*fields) + FIELDS = %i[personal_statement].freeze + + class << self + def storable_fields + FIELDS + end + + def unstorable_fields + %i[personal_statement_section_completed] + end - validates :personal_statement, presence: true + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :personal_statement))) + end + end + attr_accessor(*FIELDS) + + validates :personal_statement, presence: true, if: -> { personal_statement_section_completed } + + completed_attribute(:personal_statement) + end + end end diff --git a/app/form_models/jobseekers/job_application/professional_status_form.rb b/app/form_models/jobseekers/job_application/professional_status_form.rb index c64062d07c..536d61227b 100644 --- a/app/form_models/jobseekers/job_application/professional_status_form.rb +++ b/app/form_models/jobseekers/job_application/professional_status_form.rb @@ -1,50 +1,65 @@ -class Jobseekers::JobApplication::ProfessionalStatusForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model - - def self.fields - %i[ - qualified_teacher_status - qualified_teacher_status_year - qualified_teacher_status_details - statutory_induction_complete - teacher_reference_number - has_teacher_reference_number - ] - end - attr_accessor(*fields) +module Jobseekers + module JobApplication + class ProfessionalStatusForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - class << self - def unstorable_fields - %i[has_teacher_reference_number] - end - end + FIELDS = %i[ + qualified_teacher_status + qualified_teacher_status_year + qualified_teacher_status_details + statutory_induction_complete + teacher_reference_number + has_teacher_reference_number + ].freeze - def statutory_induction_complete_options - [ - ["yes", I18n.t("helpers.label.jobseekers_job_application_professional_status_form.statutory_induction_complete_options.yes")], - ["no", I18n.t("helpers.label.jobseekers_job_application_professional_status_form.statutory_induction_complete_options.no")], - ["on_track", I18n.t("helpers.label.jobseekers_job_application_professional_status_form.statutory_induction_complete_options.on_track")], - ] - end + attr_accessor(*FIELDS) - def initialize(attributes = {}) - jobseeker_profile = attributes.delete(:jobseeker_profile) - super + class << self + def storable_fields + FIELDS + end - return unless jobseeker_profile + def unstorable_fields + %i[has_teacher_reference_number professional_status_section_completed] + end - self.teacher_reference_number ||= jobseeker_profile.teacher_reference_number - self.has_teacher_reference_number ||= jobseeker_profile.has_teacher_reference_number - end + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :professional_status))) + end + end + + def statutory_induction_complete_options + [ + ["yes", I18n.t("helpers.label.jobseekers_job_application_professional_status_form.statutory_induction_complete_options.yes")], + ["no", I18n.t("helpers.label.jobseekers_job_application_professional_status_form.statutory_induction_complete_options.no")], + ["on_track", I18n.t("helpers.label.jobseekers_job_application_professional_status_form.statutory_induction_complete_options.on_track")], + ] + end - validates :qualified_teacher_status, inclusion: { in: %w[yes no on_track] } - validates :qualified_teacher_status_year, numericality: { less_than_or_equal_to: proc { Time.current.year } }, - if: -> { qualified_teacher_status == "yes" } - validates :statutory_induction_complete, inclusion: { in: %w[yes no on_track] } + def initialize(attributes = {}) + jobseeker_profile = attributes.delete(:jobseeker_profile) + super - validates :teacher_reference_number, presence: true, if: -> { qualified_teacher_status == "yes" } - validates_format_of :teacher_reference_number, with: /\A\d{7}\z/, allow_blank: false, if: -> { qualified_teacher_status == "yes" || has_teacher_reference_number == "yes" } - validates_format_of :teacher_reference_number, with: /\A\d{7}\z/, allow_blank: true, if: -> { qualified_teacher_status == "no" || qualified_teacher_status == "on_track" } - validates :has_teacher_reference_number, inclusion: { in: %w[yes] }, if: -> { qualified_teacher_status == "yes" } - validates :has_teacher_reference_number, inclusion: { in: %w[yes no] }, if: -> { qualified_teacher_status == "no" || qualified_teacher_status == "on_track" } + return unless jobseeker_profile + + self.teacher_reference_number ||= jobseeker_profile.teacher_reference_number + self.has_teacher_reference_number ||= jobseeker_profile.has_teacher_reference_number + end + + validates :qualified_teacher_status, inclusion: { in: %w[yes no on_track] }, if: -> { professional_status_section_completed } + validates :qualified_teacher_status_year, numericality: { less_than_or_equal_to: proc { Time.current.year } }, + if: -> { qualified_teacher_status == "yes" && professional_status_section_completed } + validates :statutory_induction_complete, inclusion: { in: %w[yes no on_track] }, if: -> { professional_status_section_completed } + + validates :teacher_reference_number, presence: true, if: -> { qualified_teacher_status == "yes" && professional_status_section_completed } + validates_format_of :teacher_reference_number, with: /\A\d{7}\z/, allow_blank: false, if: -> { qualified_teacher_status == "yes" || has_teacher_reference_number == "yes" } + validates_format_of :teacher_reference_number, with: /\A\d{7}\z/, allow_blank: true, if: -> { qualified_teacher_status.in?(%w[no on_track]) } + validates :has_teacher_reference_number, inclusion: { in: %w[yes] }, if: -> { qualified_teacher_status == "yes" && professional_status_section_completed } + validates :has_teacher_reference_number, inclusion: { in: %w[yes no] }, if: -> { qualified_teacher_status.in?(%w[no on_track]) && professional_status_section_completed } + + completed_attribute(:professional_status) + end + end end diff --git a/app/form_models/jobseekers/job_application/qualifications_form.rb b/app/form_models/jobseekers/job_application/qualifications_form.rb index cccbe20831..7527ce2a1e 100644 --- a/app/form_models/jobseekers/job_application/qualifications_form.rb +++ b/app/form_models/jobseekers/job_application/qualifications_form.rb @@ -1,10 +1,21 @@ -class Jobseekers::JobApplication::QualificationsForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model +module Jobseekers + module JobApplication + class QualificationsForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - def self.fields - %i[qualifications_section_completed] - end - attr_accessor(*fields) + class << self + def unstorable_fields + [:qualifications_section_completed] + end + + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :qualifications))) + end + end - validates :qualifications_section_completed, presence: true + completed_attribute(:qualifications) + end + end end diff --git a/app/form_models/jobseekers/job_application/references_form.rb b/app/form_models/jobseekers/job_application/references_form.rb index 63b9e1c685..34f7d548b5 100644 --- a/app/form_models/jobseekers/job_application/references_form.rb +++ b/app/form_models/jobseekers/job_application/references_form.rb @@ -1,7 +1,25 @@ -class Jobseekers::JobApplication::ReferencesForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model +module Jobseekers + module JobApplication + class ReferencesForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - def self.optional? - false + class << self + def unstorable_fields + %i[references_section_completed] + end + + def optional? + false + end + + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :references))) + end + end + + completed_attribute(:references) + end end end diff --git a/app/form_models/jobseekers/job_application/training_and_cpds_form.rb b/app/form_models/jobseekers/job_application/training_and_cpds_form.rb index 275f5b976b..e7a45900fd 100644 --- a/app/form_models/jobseekers/job_application/training_and_cpds_form.rb +++ b/app/form_models/jobseekers/job_application/training_and_cpds_form.rb @@ -1,10 +1,21 @@ -class Jobseekers::JobApplication::TrainingAndCpdsForm < Jobseekers::JobApplication::BaseForm - include ActiveModel::Model +module Jobseekers + module JobApplication + class TrainingAndCpdsForm < BaseForm + include ActiveModel::Model + include ActiveModel::Attributes + include CompletedFormAttribute - def self.fields - %i[training_and_cpds_section_completed] - end - attr_accessor(*fields) + class << self + def unstorable_fields + %i[training_and_cpds_section_completed] + end + + def load_form(model) + load_form_attributes(model.attributes.merge(completed_attrs(model, :training_and_cpds))) + end + end - validates :training_and_cpds_section_completed, presence: true + completed_attribute(:training_and_cpds) + end + end end diff --git a/app/helpers/components_helper.rb b/app/helpers/components_helper.rb index 4e54416f1f..d2e47dbe77 100644 --- a/app/helpers/components_helper.rb +++ b/app/helpers/components_helper.rb @@ -9,14 +9,11 @@ module ComponentsHelper landing_page_link_group: "LandingPageLinkGroupComponent", map: "MapComponent", navigation_list: "NavigationListComponent", - review: "ReviewComponent", editor: "EditorComponent", searchable_collection: "SearchableCollectionComponent", supportal_table: "SupportalTableComponent", tabs: "TabsComponent", vacancy_form_page_heading: "VacancyFormPageHeadingComponent", - vacancy_review: "VacancyReviewComponent", - vacancy_selector: "VacancySelectorComponent", validatable_summary_list: "ValidatableSummaryListComponent", }.each do |name, klass| define_method(name) do |*args, **kwargs, &block| diff --git a/app/helpers/job_applications_helper.rb b/app/helpers/job_applications_helper.rb index 9775454076..bdbb378ab1 100644 --- a/app/helpers/job_applications_helper.rb +++ b/app/helpers/job_applications_helper.rb @@ -175,7 +175,6 @@ def job_application_sample(vacancy) # rubocop: disable Metrics/MethodLength, Met In the classroom, I always strive to modify my approach to suit a range of abilities and motivation. By planning lessons around my students’ interests, I have been able to inspire even the most unmotivated readers into a love of books. For example, teaching descriptive writing by looking at their favourite sports and persuasive writing via marketing materials for their favourite shops. Furthermore, I have worked with dozens of students for whom English is their second language and nothing motivates me more than seeing that lightbulb moment happen when they can see their own progress. Last year, 95% of my GCSE students passed with grade 5 or above, and I have a proven track record for ensuring all of my KS3 students improve by at least two grades over years 7 to 9.
Moreover, I believe that good teaching doesn’t just happen in the classroom. I am a strong advocate for student wellbeing and pastoral support and have greatly enjoyed leading a morning form class for the last three years. Also, in my current school I have contributed to the English department by running a weekly book club, and organising several school trips to literary locations such as Haworth and Stratford Upon Avon, as well as visits to see plays on the curriculum.
I really resonate with your school’s ethos around inclusion and leaving no student behind, and I hope to be an asset to your English department, while continuing to grow as a teacher.", - employment_history_section_completed: true, employments: [ Employment.new( diff --git a/app/helpers/status_tag_helper.rb b/app/helpers/status_tag_helper.rb index 0dfd1c82ed..bda8357707 100644 --- a/app/helpers/status_tag_helper.rb +++ b/app/helpers/status_tag_helper.rb @@ -1,5 +1,6 @@ module StatusTagHelper - def review_section_tag(resource, steps, form_classes) + def review_section_tag(resource, form_classes) + steps = form_classes.map(&:target_name) if resource.is_a?(JobApplication) && steps.all? { |step| job_application_step_imported?(resource, step) } imported elsif form_classes.all?(&:optional?) diff --git a/app/models/job_application.rb b/app/models/job_application.rb index 1603b57dc5..e43dd66cb7 100644 --- a/app/models/job_application.rb +++ b/app/models/job_application.rb @@ -37,6 +37,10 @@ class JobApplication < ApplicationRecord personal_details: 2, professional_status: 3, training_and_cpds: 4, + references: 5, + equal_opportunities: 6, + personal_statement: 7, + declarations: 8, } # If you want to add a status, be sure to add a `status_at` column to the `job_applications` table @@ -66,6 +70,9 @@ class JobApplication < ApplicationRecord validates :email_address, email_address: true, if: -> { email_address_changed? } # Allows data created prior to validation to still be valid + # TODO: drop these columns once this been released + self.ignored_columns += %w[training_and_cpds_section_completed employment_history_section_completed qualifications_section_completed] + def name "#{first_name} #{last_name}" end @@ -110,7 +117,7 @@ def anonymise_report def fill_in_report report = vacancy.equal_opportunities_report || vacancy.build_equal_opportunities_report - Jobseekers::JobApplication::EqualOpportunitiesForm.fields.each do |attr| + Jobseekers::JobApplication::EqualOpportunitiesForm.storable_fields.each do |attr| attr_value = public_send(attr) next unless attr_value.present? @@ -126,7 +133,7 @@ def fill_in_report end def reset_equal_opportunities_attributes - Jobseekers::JobApplication::EqualOpportunitiesForm.fields.each { |attr| self[attr] = "" } + Jobseekers::JobApplication::EqualOpportunitiesForm.storable_fields.each { |attr| self[attr] = "" } end def reset_support_needed_details diff --git a/app/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile.rb b/app/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile.rb index 869cfecc3b..bfa2e6c788 100644 --- a/app/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile.rb +++ b/app/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile.rb @@ -38,8 +38,6 @@ def copy_qualifications new_result.update(qualification: new_qualification) end end - - new_job_application.qualifications_section_completed = false end def copy_employments @@ -47,8 +45,6 @@ def copy_employments new_employment = employment.dup new_employment.update(job_application: new_job_application, salary: "") end - - new_job_application.employment_history_section_completed = false end def copy_training_and_cpds @@ -56,8 +52,6 @@ def copy_training_and_cpds new_training = training.dup new_training.update(job_application: new_job_application) end - - new_job_application.training_and_cpds_section_completed = false end # rubocop:disable Metrics/AbcSize diff --git a/app/services/jobseekers/job_applications/prefill_job_application_from_previous_application.rb b/app/services/jobseekers/job_applications/prefill_job_application_from_previous_application.rb index 083ba3a6e0..ab4e894c1b 100644 --- a/app/services/jobseekers/job_applications/prefill_job_application_from_previous_application.rb +++ b/app/services/jobseekers/job_applications/prefill_job_application_from_previous_application.rb @@ -44,8 +44,6 @@ def copy_qualifications new_result.update(qualification: new_qualification) end end - - new_job_application.qualifications_section_completed = true end def copy_employments @@ -53,8 +51,6 @@ def copy_employments new_employment = employment.dup new_employment.update(job_application: new_job_application, salary: "") end - - new_job_application.employment_history_section_completed = !previous_application_was_submitted_before_we_began_validating_gaps_in_work_history? end def copy_references @@ -69,8 +65,6 @@ def copy_training_and_cpds new_training = training.dup new_training.update(job_application: new_job_application) end - - new_job_application.training_and_cpds_section_completed = true end def set_status_of_each_step diff --git a/app/views/jobseekers/job_applications/_job_application.html.slim b/app/views/jobseekers/job_applications/_job_application.html.slim index b87826ca52..64a8a942db 100644 --- a/app/views/jobseekers/job_applications/_job_application.html.slim +++ b/app/views/jobseekers/job_applications/_job_application.html.slim @@ -1,4 +1,4 @@ -- job_application_link = job_application.draft? ? jobseekers_job_application_review_path(job_application) : jobseekers_job_application_path(job_application) +- job_application_link = job_application.draft? ? jobseekers_job_application_apply_path(job_application) : jobseekers_job_application_path(job_application) = render CardComponent.new do |card| - card.with_header do diff --git a/app/views/jobseekers/job_applications/_show.html.slim b/app/views/jobseekers/job_applications/_show.html.slim index 8bb8c8deee..13f862a9d5 100644 --- a/app/views/jobseekers/job_applications/_show.html.slim +++ b/app/views/jobseekers/job_applications/_show.html.slim @@ -1,4 +1,4 @@ -= job_application_review(job_application, step_process: step_process, show_tracks: false, allow_edit: local_assigns[:allow_edit]) do |r| += job_application_review(job_application, allow_edit: local_assigns[:allow_edit]) do |r| - render "jobseekers/job_applications/job_application_review_sections", r: r - r.with_above do = yield diff --git a/app/views/jobseekers/job_applications/apply.html.slim b/app/views/jobseekers/job_applications/apply.html.slim new file mode 100644 index 0000000000..e9ac7af350 --- /dev/null +++ b/app/views/jobseekers/job_applications/apply.html.slim @@ -0,0 +1,74 @@ +- content_for :page_title_prefix, job_application_page_title_prefix(review_form, t(".title")) + += job_application_review(@job_application) do |r| + - r.with_header do + = render "banner" + + - r.with_above do + - unless vacancy.listed? + = govuk_notification_banner title_text: t("banners.important") do + p.govuk-body = t(".deadline_passed") + + - unless review_form.errors.any? + = render "shared/error_messages", model: @job_application, presenter: ErrorSummaryPresenter.new(@job_application.errors) + + - if current_jobseeker.job_applications.not_draft.none? + span.govuk-caption-m + = t("jobseekers.job_applications.current_step", current: step_process.current_step_group_number, total: step_process.total_step_groups) + + h2.govuk-heading-m = t(".heading") + + = govuk_task_list do |task_list| + - task_list.with_item(title: t("jobseekers.job_applications.build.personal_details.heading"), href: jobseekers_job_application_build_path(job_application, :personal_details), + html_attributes: { id: :personal_details }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::PersonalDetailsForm])) + + - task_list.with_item(title: t("jobseekers.job_applications.build.professional_status.heading"), href: jobseekers_job_application_build_path(job_application, :professional_status), + html_attributes: { id: :professional_status }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::ProfessionalStatusForm])) + + - task_list.with_item(title: t("jobseekers.job_applications.build.qualifications.heading"), href: jobseekers_job_application_build_path(job_application, :qualifications), + html_attributes: { id: :qualifications }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::QualificationsForm])) + + - task_list.with_item(title: t("jobseekers.job_applications.build.training_and_cpds.heading"), href: jobseekers_job_application_build_path(job_application, :training_and_cpds), + html_attributes: { id: :training_and_cpds }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::TrainingAndCpdsForm])) + + - task_list.with_item(title: t("jobseekers.job_applications.build.employment_history.heading"), href: jobseekers_job_application_build_path(job_application, :employment_history), + html_attributes: { id: :employment_history }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::EmploymentHistoryForm])) + + - task_list.with_item(title: t("jobseekers.job_applications.build.personal_statement.heading"), href: jobseekers_job_application_build_path(job_application, :personal_statement), + html_attributes: { id: :personal_statement }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::PersonalStatementForm])) + + - task_list.with_item(title: t("jobseekers.job_applications.build.references.heading"), href: jobseekers_job_application_build_path(job_application, :references), + html_attributes: { id: :references }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::ReferencesForm])) + + - if jobseeker_signed_in? + - task_list.with_item(title: t("jobseekers.job_applications.build.equal_opportunities.heading"), href: jobseekers_job_application_build_path(job_application, :equal_opportunities), + html_attributes: { id: :equal_opportunities }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::EqualOpportunitiesForm])) + + - task_list.with_item(title: t("jobseekers.job_applications.build.ask_for_support.heading"), href: jobseekers_job_application_build_path(job_application, :ask_for_support), + classes: "ask_for_support", + html_attributes: { id: :ask_for_support }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::AskForSupportForm])) + + - task_list.with_item(title: t("jobseekers.job_applications.build.declarations.heading"), href: jobseekers_job_application_build_path(job_application, :declarations), + html_attributes: { id: :declarations }, + status: review_section_tag(job_application, [Jobseekers::JobApplication::DeclarationsForm])) + + h2.govuk-heading-m = t(".review_and_submit") + + p.govuk-body = t(".you_will_have") + + - r.with_below do + - unless @job_application.deadline_passed? + = form_for review_form, url: jobseekers_job_application_pre_submit_path(job_application), method: :post do |f| + = f.govuk_error_summary + + - if vacancy.listed? + = f.govuk_submit t(".review_application") diff --git a/app/views/jobseekers/job_applications/build/_steps.html.slim b/app/views/jobseekers/job_applications/build/_steps.html.slim deleted file mode 100644 index 365e01b119..0000000000 --- a/app/views/jobseekers/job_applications/build/_steps.html.slim +++ /dev/null @@ -1,4 +0,0 @@ -= render StepsComponent.new title: t("jobseekers.job_applications.review.steps"), classes: "govuk-!-margin-top-6" do |component| - - step_process.step_groups.keys.excluding(:review).each do |wizard_step| - - component.with_step(label: t("jobseekers.job_applications.build.#{wizard_step}.step_title"), current: (wizard_step == step_process.current_step_group), completed: wizard_step.to_s.in?(job_application.completed_steps)) - - component.with_step(label: t("jobseekers.job_applications.review.heading"), current: false, completed: false) diff --git a/app/views/jobseekers/job_applications/build/ask_for_support.html.slim b/app/views/jobseekers/job_applications/build/ask_for_support.html.slim index 1493e2845d..e33cb5a1b4 100644 --- a/app/views/jobseekers/job_applications/build/ask_for_support.html.slim +++ b/app/views/jobseekers/job_applications/build/ask_for_support.html.slim @@ -3,7 +3,7 @@ = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div - if current_jobseeker.job_applications.not_draft.none? = render "caption" h2.govuk-heading-l = t(".heading") @@ -15,7 +15,7 @@ li = example p.govuk-body = t(".closing") - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :ask_for_support), method: :patch do |f| = f.govuk_error_summary = f.govuk_radio_buttons_fieldset :support_needed do @@ -23,11 +23,9 @@ = f.govuk_text_area :support_needed_details, rows: 10 = f.govuk_radio_button :support_needed, :no + = f.govuk_collection_radio_buttons :ask_for_support_section_completed, %w[true false], :to_s + = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/build/declarations.html.slim b/app/views/jobseekers/job_applications/build/declarations.html.slim index 33f4b51ba1..b542d2ca2e 100644 --- a/app/views/jobseekers/job_applications/build/declarations.html.slim +++ b/app/views/jobseekers/job_applications/build/declarations.html.slim @@ -3,7 +3,7 @@ = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div - if current_jobseeker.job_applications.not_draft.none? = render "caption" h2.govuk-heading-l = t(".heading") @@ -14,7 +14,7 @@ p.govuk-body = govuk_link_to(t(".description4"), "https://www.gov.uk/tell-employer-or-college-about-criminal-record") p.govuk-body = t(".description5", link_text: govuk_link_to(t(".keep_children_safe_link_text"), "https://www.gov.uk/government/publications/keeping-children-safe-in-education--2")).html_safe - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :declarations), method: :patch do |f| = f.govuk_error_summary = f.govuk_radio_buttons_fieldset :safeguarding_issue, legend: { text: t("helpers.legend.jobseekers_job_application_declarations_form.safeguarding_issue", organisation: vacancy.organisation_name) } do @@ -27,11 +27,9 @@ = f.govuk_text_field :close_relationships_details = f.govuk_radio_button :close_relationships, :no + = f.govuk_collection_radio_buttons :declarations_section_completed, %w[true false], :to_s + = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/build/employment_history.html.slim b/app/views/jobseekers/job_applications/build/employment_history.html.slim index ffc848aade..82fb8d0e23 100644 --- a/app/views/jobseekers/job_applications/build/employment_history.html.slim +++ b/app/views/jobseekers/job_applications/build/employment_history.html.slim @@ -1,12 +1,11 @@ -= form_for form, url: wizard_path, method: :patch do |f| += form_for form, url: jobseekers_job_application_build_path(job_application, :employment_history), method: :patch do |f| = f.govuk_error_summary(presenter: WorkHistoryErrorSummaryPresenter.new(form.errors.messages, form.unexplained_employment_gaps)) - - content_for :page_title_prefix, job_application_page_title_prefix(form, t(".title")) = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div - if current_jobseeker.job_applications.not_draft.none? = render "caption" h2.govuk-heading-l = t(".heading") @@ -51,16 +50,10 @@ = govuk_link_to t("buttons.add_reason_for_break"), new_jobseekers_job_application_break_path(job_application, started_on: gap[:started_on], ended_on: gap[:ended_on] || Date.current) - unexplained_employment_gaps_present = job_application.unexplained_employment_gaps.present? - = f.govuk_radio_buttons_fieldset(:employment_history_section_completed, legend: { size: "m" }) do - = f.govuk_radio_button :employment_history_section_completed, "true", label: { text: t("helpers.label.jobseekers_job_application_employment_history_form.employment_history_section_completed_options.true") }, link_errors: true - = f.govuk_radio_button :employment_history_section_completed, "false", label: { text: t("helpers.label.jobseekers_job_application_employment_history_form.employment_history_section_completed_options.false") } - end + = f.govuk_collection_radio_buttons :employment_history_section_completed, %w[true false], :to_s + = f.hidden_field :unexplained_employment_gaps_present, value: unexplained_employment_gaps_present = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/build/equal_opportunities.html.slim b/app/views/jobseekers/job_applications/build/equal_opportunities.html.slim index 1f214adc8d..80b5e59ae8 100644 --- a/app/views/jobseekers/job_applications/build/equal_opportunities.html.slim +++ b/app/views/jobseekers/job_applications/build/equal_opportunities.html.slim @@ -3,7 +3,7 @@ = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div - if current_jobseeker.job_applications.not_draft.none? = render "caption" h2.govuk-heading-l = t(".heading") @@ -12,7 +12,7 @@ p.govuk-body = t(".anonymity") p.govuk-body = t(".optional") - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :equal_opportunities), method: :patch do |f| = f.govuk_error_summary = f.govuk_radio_buttons_fieldset :disability do @@ -71,11 +71,9 @@ = f.govuk_radio_divider = f.govuk_radio_button :religion, :prefer_not_to_say + = f.govuk_collection_radio_buttons :equal_opportunities_section_completed, %w[true false], :to_s + = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/build/personal_details.html.slim b/app/views/jobseekers/job_applications/build/personal_details.html.slim index 556e751db9..74309deeea 100644 --- a/app/views/jobseekers/job_applications/build/personal_details.html.slim +++ b/app/views/jobseekers/job_applications/build/personal_details.html.slim @@ -3,13 +3,13 @@ = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div - if current_jobseeker.job_applications.not_draft.none? = render "caption" h2.govuk-heading-l = t(".heading") p.govuk-body = t(".description") - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :personal_details), method: :patch do |f| = f.govuk_error_summary = f.govuk_text_field :first_name, label: { size: "s" }, width: "one-half", aria: { required: true } @@ -38,11 +38,9 @@ = f.govuk_text_field :national_insurance_number, label: { size: "s" }, width: "one-half" = f.govuk_radio_button :has_ni_number, :no + = f.govuk_collection_radio_buttons :personal_details_section_completed, %w[true false], :to_s + = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/build/personal_statement.html.slim b/app/views/jobseekers/job_applications/build/personal_statement.html.slim index 9f1a8aebdd..4d68652ae2 100644 --- a/app/views/jobseekers/job_applications/build/personal_statement.html.slim +++ b/app/views/jobseekers/job_applications/build/personal_statement.html.slim @@ -28,20 +28,19 @@ h3.govuk-heading-s = t(".additional_instructions") = govuk_inset_text text: job_application.vacancy.personal_statement_guidance - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :personal_statement), method: :patch do |f| = f.govuk_error_summary = f.govuk_text_area :personal_statement, label: { size: "s" }, rows: 15, required: true, aria: { required: true }, hint: { text: t(".hint") } + = f.govuk_collection_radio_buttons :personal_statement_section_completed, %w[true false], :to_s + = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") .govuk-grid-column-one-third - - if current_jobseeker.job_applications.not_draft.none? - = render "steps" - .help-guide--desktop class="govuk-!-margin-top-6" h3.govuk-heading-m = t(".personal_statement_guide.title") p.govuk-body = t(".personal_statement_guide.description_desktop") diff --git a/app/views/jobseekers/job_applications/build/professional_status.html.slim b/app/views/jobseekers/job_applications/build/professional_status.html.slim index 164fe26485..e35b188114 100644 --- a/app/views/jobseekers/job_applications/build/professional_status.html.slim +++ b/app/views/jobseekers/job_applications/build/professional_status.html.slim @@ -3,12 +3,12 @@ = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div - if current_jobseeker.job_applications.not_draft.none? = render "caption" h2.govuk-heading-l = t(".heading") - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :professional_status), method: :patch do |f| = f.govuk_error_summary = f.govuk_radio_buttons_fieldset :qualified_teacher_status, hint: -> { tag.p(t("helpers.label.jobseekers_job_application_professional_status_form.hint", link: govuk_link_to(t("helpers.label.jobseekers_job_application_professional_status_form.link_text"), "https://www.gov.uk/guidance/qualified-teacher-status-qts", target: "_blank")).html_safe) } do @@ -23,11 +23,9 @@ = f.govuk_text_field :teacher_reference_number, label: { text: t("helpers.legend.jobseekers_job_application_professional_status_form.teacher_reference_number") } = f.govuk_radio_button :has_teacher_reference_number, "no", label: { text: t("helpers.legend.jobseekers_job_application_professional_status_form.has_teacher_reference_number_options.no") } - = f.govuk_collection_radio_buttons :statutory_induction_complete, f.object.statutory_induction_complete_options, :first, :last, hint: { text: t("helpers.label.jobseekers_job_application_professional_status_form.completed_period_hint") } + = f.govuk_collection_radio_buttons :statutory_induction_complete, f.object.statutory_induction_complete_options, :first, :last + + = f.govuk_collection_radio_buttons :professional_status_section_completed, %w[true false], :to_s = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/build/qualifications.html.slim b/app/views/jobseekers/job_applications/build/qualifications.html.slim index 126ba7a6d5..0e5b541082 100644 --- a/app/views/jobseekers/job_applications/build/qualifications.html.slim +++ b/app/views/jobseekers/job_applications/build/qualifications.html.slim @@ -3,7 +3,7 @@ = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div - if current_jobseeker.job_applications.not_draft.none? = render "caption" h2.govuk-heading-l = t(".heading") @@ -39,14 +39,10 @@ = render EmptySectionComponent.new title: t(".no_qualifications") do = govuk_button_link_to t("buttons.add_qualification"), select_category_jobseekers_job_application_qualifications_path(job_application), class: "govuk-button--secondary govuk-!-margin-bottom-0" - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :qualifications), method: :patch do |f| = f.govuk_error_summary = f.govuk_collection_radio_buttons :qualifications_section_completed, %w[true false], :to_s = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/build/references.html.slim b/app/views/jobseekers/job_applications/build/references.html.slim index 84a8b2a361..f18d3b0b40 100644 --- a/app/views/jobseekers/job_applications/build/references.html.slim +++ b/app/views/jobseekers/job_applications/build/references.html.slim @@ -3,7 +3,7 @@ = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div = render "caption" h2.govuk-heading-l = t(".heading") @@ -34,19 +34,12 @@ = render EmptySectionComponent.new title: t(".no_references") do = govuk_button_link_to t("buttons.add_reference"), new_jobseekers_job_application_reference_path(job_application), class: "govuk-!-margin-bottom-0" - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :references), method: :patch do |f| = f.govuk_error_summary - - if job_application.references.many? - = f.govuk_submit job_application_build_submit_button_text do - = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" - span.govuk-caption-m - = t("jobseekers.job_applications.cancel_caption") - - else + = f.govuk_collection_radio_buttons :references_section_completed, %w[true false], :to_s + + = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/build/training_and_cpds.html.slim b/app/views/jobseekers/job_applications/build/training_and_cpds.html.slim index f5b301ad82..dacc57da0c 100644 --- a/app/views/jobseekers/job_applications/build/training_and_cpds.html.slim +++ b/app/views/jobseekers/job_applications/build/training_and_cpds.html.slim @@ -3,7 +3,7 @@ = render "banner", vacancy: vacancy, back_path: back_path .govuk-grid-row - .govuk-grid-column-two-thirds + div = render "caption" h2.govuk-heading-l = t(".heading") @@ -27,14 +27,10 @@ = render EmptySectionComponent.new title: t(".no_training") do = govuk_button_link_to t("buttons.add_training"), new_jobseekers_job_application_training_and_cpd_path(job_application), class: "govuk-!-margin-bottom-0" - = form_for form, url: wizard_path, method: :patch do |f| + = form_for form, url: jobseekers_job_application_build_path(job_application, :training_and_cpds), method: :patch do |f| = f.govuk_error_summary = f.govuk_collection_radio_buttons :training_and_cpds_section_completed, %w[true false], :to_s = f.govuk_submit job_application_build_submit_button_text do = govuk_link_to t("buttons.cancel_and_return_to_account"), jobseekers_job_applications_path, class: "govuk-link--no-visited-state" span.govuk-caption-m = t("jobseekers.job_applications.cancel_caption") - - - if current_jobseeker.job_applications.not_draft.none? - .govuk-grid-column-one-third - = render "steps" diff --git a/app/views/jobseekers/job_applications/review.html.slim b/app/views/jobseekers/job_applications/review.html.slim index 26d5b00c1d..070db18e01 100644 --- a/app/views/jobseekers/job_applications/review.html.slim +++ b/app/views/jobseekers/job_applications/review.html.slim @@ -1,6 +1,6 @@ - content_for :page_title_prefix, job_application_page_title_prefix(review_form, t(".title")) -= job_application_review(@job_application, step_process: step_process, show_tracks: current_jobseeker.job_applications.not_draft.none?) do |r| += job_application_review(@job_application, show_sidebar: false) do |r| - r.with_header do = render "banner" diff --git a/app/views/jobseekers/job_applications/review/_training_and_cpds.html.slim b/app/views/jobseekers/job_applications/review/_training_and_cpds.html.slim index b0580b2d95..9d9c46e1a1 100644 --- a/app/views/jobseekers/job_applications/review/_training_and_cpds.html.slim +++ b/app/views/jobseekers/job_applications/review/_training_and_cpds.html.slim @@ -6,11 +6,11 @@ p.govuk-body = t("jobseekers.job_applications.show.training_and_cpds.none") - else - job_application.training_and_cpds.each do |training| - p class="govuk-!-margin-bottom-1" - = training.name - - if training.grade.present? - span class="govuk-!-display-inline-block govuk-!-margin-left-1" - = "(#{training.grade})" - p class="govuk-!-margin-bottom-1" = training.course_length - p.govuk-caption-m - = "#{training.provider}, #{training.year_awarded}" + p class="govuk-!-margin-bottom-1" + = training.name + - if training.grade.present? + span class="govuk-!-display-inline-block govuk-!-margin-left-1" + = "(#{training.grade})" + p class="govuk-!-margin-bottom-1" = training.course_length + p.govuk-caption-m + = "#{training.provider}, #{training.year_awarded}" diff --git a/app/views/publishers/vacancies/build/applying_for_the_job.html.slim b/app/views/publishers/vacancies/build/applying_for_the_job.html.slim index 8138760aab..27cb91e0a9 100644 --- a/app/views/publishers/vacancies/build/applying_for_the_job.html.slim +++ b/app/views/publishers/vacancies/build/applying_for_the_job.html.slim @@ -12,7 +12,7 @@ p.govuk-body = t(".reason_for_our_form") = govuk_details(summary_text: "See what an application form looks like") do - = job_application_review(job_application_sample(vacancy), step_process: {}, show_tracks: false, show_sidebar: false, allow_edit: false) do |r| + = job_application_review(job_application_sample(vacancy), show_sidebar: false, allow_edit: false) do |r| - render "jobseekers/job_applications/job_application_review_sections", r: r, job_application: r.job_application - if vacancy.listed? diff --git a/app/views/publishers/vacancies/job_applications/_application_details_and_notes.html.slim b/app/views/publishers/vacancies/job_applications/_application_details_and_notes.html.slim index bdd98c51d2..dcfe68f3c0 100644 --- a/app/views/publishers/vacancies/job_applications/_application_details_and_notes.html.slim +++ b/app/views/publishers/vacancies/job_applications/_application_details_and_notes.html.slim @@ -1,4 +1,4 @@ -= job_application_review(job_application, step_process: step_process, show_tracks: false, allow_edit: local_assigns[:allow_edit]) do |r| += job_application_review(job_application, allow_edit: local_assigns[:allow_edit]) do |r| - render "jobseekers/job_applications/job_application_review_sections", r: r - r.with_above do @@ -20,10 +20,10 @@ .govuk-summary-card__content - job_application.notes.each do |note| - p.govuk-body-m = note.content - p.govuk-body-s By #{note.publisher.given_name} #{note.publisher.family_name}, #{note.created_at} - = govuk_link_to(t("buttons.delete"), organisation_job_job_application_note_path(vacancy.id, job_application, note), method: :delete) - hr.govuk-section-break.govuk-section-break--l.govuk-section-break--visible + p.govuk-body-m = note.content + p.govuk-body-s By #{note.publisher.given_name} #{note.publisher.family_name}, #{note.created_at} + = govuk_link_to(t("buttons.delete"), organisation_job_job_application_note_path(vacancy.id, job_application, note), method: :delete) + hr.govuk-section-break.govuk-section-break--l.govuk-section-break--visible = form_for @notes_form, url: organisation_job_job_application_notes_path(vacancy.id, job_application), html: { data: { "show-hidden-content-target": "content" } } do |f| = f.govuk_error_summary diff --git a/config/analytics.yml b/config/analytics.yml index 3464b4c639..74608e60d2 100644 --- a/config/analytics.yml +++ b/config/analytics.yml @@ -144,7 +144,6 @@ shared: - withdrawn_by_closing_account - safeguarding_issue - safeguarding_issue_details - - training_and_cpds_section_completed - imported_steps job_preferences_locations: - id diff --git a/config/analytics_blocklist.yml b/config/analytics_blocklist.yml index 56da111410..b220c6d1b6 100644 --- a/config/analytics_blocklist.yml +++ b/config/analytics_blocklist.yml @@ -84,8 +84,6 @@ - rejection_reasons_ciphertext - gaps_in_employment_details_ciphertext - in_progress_steps - - employment_history_section_completed - - qualifications_section_completed :employments: - organisation_ciphertext - job_title_ciphertext diff --git a/config/locales/activerecord.yml b/config/locales/activerecord.yml index b6c7635c98..c6135b4207 100644 --- a/config/locales/activerecord.yml +++ b/config/locales/activerecord.yml @@ -476,100 +476,6 @@ en: blank: Tick the box to agree to the terms and conditions # Job application - jobseekers/job_application/ask_for_support_form: - attributes: - support_needed: - inclusion: Select yes if you would like interview support - support_needed_details: - blank: Give details about what support you might need - # TODO: Update content once confirmed - present: If you don't need support, extra information must be blank - jobseekers/job_application/declarations_form: - attributes: - close_relationships: - inclusion: Select yes if you have a close relationship with people within the organisation - close_relationships_details: - blank: Give details about any close relationships with people within the organisation - safeguarding_issue: - inclusion: Select yes if you have a safeguarding issue to declare - safeguarding_issue_details: - blank: Provide details about your safeguarding issue - jobseekers/job_application/employment_history_form: - attributes: - employment_history_section_completed: - blank: Select yes if you have completed this section - jobseekers/job_application/equal_opportunities_form: - attributes: - age: - inclusion: Select an age range or ‘Prefer not to say’ - disability: - inclusion: Select yes if you consider yourself to have a disability - ethnicity: - inclusion: Select an ethnic group or ‘Prefer not to say’ - ethnicity_description: - blank: Describe your ethnic group - gender: - inclusion: Select a gender or ‘Prefer not to say’ - gender_description: - blank: Describe your gender identity - orientation: - inclusion: Select a sexual orientation or ‘Prefer not to say’ - orientation_description: - blank: Describe your sexual orientation - religion: - inclusion: Select a religion or ‘Prefer not to say’ - religion_description: - blank: Describe your religion or belief - jobseekers/job_application/personal_details_form: - attributes: - city: - blank: Enter your town or city - country: - blank: Enter your country - email_address: - blank: Enter your email address - invalid: Enter a valid email address in the correct format, like name@example.com - first_name: - blank: Enter your first name - last_name: - blank: Enter your last name - national_insurance_number: - invalid: Enter a National Insurance number in the correct format - phone_number: - blank: Enter your phone number - invalid: Enter a phone number in the correct format - postcode: - blank: Enter your postcode - street_address: - blank: Enter your building and street - teacher_reference_number: - invalid: Enter a teacher reference number (TRN) that is 7 digits long - right_to_work_in_uk: - inclusion: Select no if you have the right to work in the UK - has_ni_number: - inclusion: Select yes if you have a National Insurance number - jobseekers/job_application/personal_statement_form: - attributes: - personal_statement: - blank: Enter your personal statement - jobseekers/job_application/professional_status_form: - attributes: - qualified_teacher_status: - inclusion: Select yes if you have qualified teacher status - qualified_teacher_status_year: - less_than_or_equal_to: The year your QTS was awarded must be the current year or in the past - not_a_number: Enter the year your QTS was awarded - teacher_reference_number: - invalid: Enter a teacher reference number (TRN) that is 7 digits long - blank: Enter a teacher reference number (TRN) that is 7 digits long - has_teacher_reference_number: - inclusion: Select yes and enter your teacher reference number (TRN). All teachers with QTS have a 7 digit TRN. - statutory_induction_complete: - inclusion: Select yes if you have completed your statutory induction year - jobseekers/job_application/qualifications_form: - attributes: - qualifications_section_completed: - blank: Select yes if you have completed this section jobseekers/job_application/training_and_cpds_form: attributes: training_and_cpds_section_completed: diff --git a/config/locales/en.yml b/config/locales/en.yml index 030904e07a..b039be4ba1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -582,8 +582,3 @@ en: paragraph1: You have saved this job in your new Teaching Vacancies account. paragraph2: If you already had a Teaching Vacancies account using a different email address, you can %{link} transfer_account_link_text: transfer your account information. - - vacancy_selector_component: - job: - expires_on: "Closing date: %{date}" - not_set: not set diff --git a/config/locales/forms.yml b/config/locales/forms.yml index cd2e59a051..59639aee12 100644 --- a/config/locales/forms.yml +++ b/config/locales/forms.yml @@ -145,11 +145,6 @@ en: jobseekers_close_account_feedback_form: close_account_reason_comment: Your feedback will help us improve the service - jobseekers_job_application_declarations_form: - right_to_work_in_uk_html: >- - You can find out whether you have the right to work in the UK on the - GOV.UK website (opens in new tab). You can apply for this role even if you do not have the - right to work in the UK. jobseekers_break_form: reason_for_break: "For example, 'I was unemployed', 'I had health issues' or 'I was caring for a child'" jobseekers_job_application_details_employment_form: @@ -165,30 +160,12 @@ en: hint1: One of your referees should be your current or most recent employer. hint2: If you do not have an employer referee, you can provide a personal referee. hint3: Your employer reference does not have to be paid employment and can include voluntary work. - jobseekers_job_application_employment_history_form: - employment_history_section_completed: Ensure you've added all your employment history. - jobseekers_job_application_equal_opportunities_form: - gender: If the options below do not reflect how you identify, please select ‘Other gender identity’. - ethnicity: If the options below do not reflect how you identify, please select ‘Other ethnic group’. - ethnicity_options: - asian: Includes Indian, Pakistani, Bangladeshi or Chinese - mixed: Includes White and Black Caribbean, White and Black African or White and Asian - white: Includes English, Welsh, Scottish, Northern Irish, British, Irish Gypsy or Irish Traveller - orientation: If the options below do not reflect how you identify, please select ‘Other sexual orientation’. - religion: >- - You can select ‘Other religion or belief’ if your beliefs are not represented by one of the given options. jobseekers_job_application_feedback_form: email: >- We'll only use this to tell you about opportunities to take part in user research that helps us improve Department for Education services. occupation: >- We'll only use this to tell you about opportunities to take part in user research that is relevant to you. - jobseekers_job_application_personal_details_form: - has_ni_number: >- - You can find this on your National Insurance card, - benefit letter, payslip or P60. It's made up of 2 letters, 6 numbers and a final letter. - phone_number: Enter a phone number you are happy to be contacted on. For example, 01632 960 001, 07700 900 982 or +44 0808 157 0192. - previous_names: For example maiden name or name at birth, if different from the name you have now. jobseekers_qualifications_degree_form: institution: For example, a university or college qualifications_section_completed: Ensure you've added all the education and qualifications you've done. @@ -371,16 +348,6 @@ en: user_participation_response_options: interested: 'Yes' uninterested: 'No' - jobseekers_job_application_ask_for_support_form: - support_needed_details: Tell us any information you think is relevant - support_needed_options: - "no": No, I do not need support - "yes": Yes, I would like to share some information about the support that I need - jobseekers_job_application_declarations_form: - close_relationships_details: Please give details - close_relationships_options: - "no": "No" - "yes": "Yes" jobseekers_break_form: reason_for_break: Enter reasons for gap in work history jobseekers_job_application_details_employment_form: @@ -393,10 +360,6 @@ en: subjects_review: Subjects and key stages taught subjects_html: Subjects and key stages taught (optional field) reason_for_leaving: Reason for leaving role - jobseekers_job_application_employment_history_form: - employment_history_section_completed_options: - false: No, I'll come back to it later - true: Yes, I've completed this section jobseekers_job_preferences_form: role_options: education_support: Learning support or cover supervisor @@ -448,51 +411,6 @@ en: is_most_recent_employer_options: "true": "Yes" "false": "No" - jobseekers_job_application_equal_opportunities_form: - age_options: - under_twenty_five: Under 25 - twenty_five_to_twenty_nine: 25 to 29 - thirty_to_thirty_nine: 30 to 39 - forty_to_forty_nine: 40 to 49 - fifty_to_fifty_nine: 50 to 59 - sixty_and_over: 60 and over - prefer_not_to_say: Prefer not to say - disability_options: - "no": "No" - "yes": "Yes" - prefer_not_to_say: Prefer not to say - ethnicity_description_html: Please describe your ethnic group (optional field) - ethnicity_options: - asian: Asian or Asian British - black: Black African, Caribbean or Black British - mixed: Mixed or multiple ethnic group - other: Other ethnic group - prefer_not_to_say: Prefer not to say - white: White - gender_description_html: Please describe your gender identity (optional field) - gender_options: - man: Man - other: Other gender identity - prefer_not_to_say: Prefer not to say - woman: Woman - orientation_description_html: Please describe your sexual orientation (optional field) - orientation_options: - bisexual: Bisexual - gay_or_lesbian: Gay or lesbian - heterosexual: Heterosexual - other: Other sexual orientation - prefer_not_to_say: Prefer not to say - religion_description_html: Please describe your religion or belief (optional field) - religion_options: - buddhist: Buddhist - christian: Christian - hindu: Hindu - jewish: Jewish - muslim: Muslim - none: No religion, atheist or agnostic - other: Other religion or belief - prefer_not_to_say: Prefer not to say - sikh: Sikh jobseekers_job_application_feedback_form: email: What is your email address? comment_html: Do you have any suggestions on how we should improve the service? (optional field) @@ -505,44 +423,6 @@ en: user_participation_response_options: interested: 'Yes' uninterested: 'No' - jobseekers_job_application_personal_details_form: - city: Town or city - country: Country - email_address: Email address - first_name: First name - last_name: Last name - national_insurance_number_review: National Insurance number - national_insurance_number: What is your National Insurance number? - phone_number: Phone number - previous_names_review: Previous names - previous_names_html: Previous names (optional field) - street_address: Building and street - teacher_reference_number_review: Teacher reference number (TRN) - teacher_reference_number_html: Teacher reference number (TRN) (optional field) - has_ni_number_options: - "yes": "Yes" - "no": No, I do not have one or do not want to provide it yet - jobseekers_job_application_personal_statement_form: - personal_statement: Your personal statement - jobseekers_job_application_professional_status_form: - qualified_teacher_status_details_html: Please provide more detail (optional field) - qualified_teacher_status_options: - "no": "No" - on_track: I'm on track to receive my QTS - non_teacher: I'm not looking for a teaching job - "yes": "Yes" - statutory_induction_complete_options: - "no": "No" - on_track: I'm on track to complete it - "yes": "Yes, I have completed a 1 or 2 year induction period" - qualified_teacher_status_year: Year QTS was awarded - hint: You're unlikely to get a teaching job in England unless you have QTS. Find out %{link}. - completed_period_hint: New teachers before 2021 had to complete a 1 year statutory induction period. New teachers after 2021 have to complete a 2 year statutory induction period. - link_text: how to get QTS - jobseekers_job_application_qualifications_form: - qualifications_section_completed_options: - false: No, I'll come back to it later - true: Yes, I've completed this section jobseekers_job_application_training_and_cpds_form: training_and_cpds_section_completed_options: false: No, I'll come back to it later @@ -935,12 +815,6 @@ en: jobseekers_close_account_feedback_form: reason: Tell us why you are closing your account - jobseekers_job_application_ask_for_support_form: - support_needed: Do you want to ask for support so that you can attend an interview? - jobseekers_job_application_declarations_form: - close_relationships: Do you have any family or close relationship with people within %{organisation}? - right_to_work_in_uk: Do you need Skilled Worker visa sponsorship? - safeguarding_issue: Do you want to declare any substantiated safeguarding issues, such as a criminal record or professional misconduct? jobseekers_job_application_details_reference_form: phone_number: Phone number is_most_recent_employer: Is this your current or most recent employer? @@ -972,19 +846,6 @@ en: jobseekers_job_application_feedback_form: rating: How satisfied are you with your experience of using Teaching Vacancies? user_participation_response: Would you like to participate in our research? - jobseekers_job_application_personal_details_form: - your_address: Your address - has_ni_number: Do you have a national insurance number? - jobseekers_job_application_professional_status_form: - has_teacher_reference_number: "Do you have a teacher reference number (TRN)?" - has_teacher_reference_number_options: - "yes": "Yes" - "no": "No" - teacher_reference_number: What is your teacher reference number (TRN)? - statutory_induction_complete: Have you completed your statutory induction period? - qualified_teacher_status: Do you have qualified teacher status (QTS)? - jobseekers_job_application_qualifications_form: - qualifications_section_completed: Have you completed this section? jobseekers_job_application_training_and_cpds_form: training_and_cpds_section_completed: Have you completed this section? jobseekers_job_application_withdraw_form: diff --git a/config/locales/jobseekers.yml b/config/locales/jobseekers.yml index b063e37098..08879759ba 100644 --- a/config/locales/jobseekers.yml +++ b/config/locales/jobseekers.yml @@ -96,7 +96,13 @@ en: example3: first aid courses example4: Team Teach job_applications: - apply: Apply for this job + apply: + apply: Apply for this job + heading: Your application + review_application: Review application + review_and_submit: Review and submit your application + you_will_have: You will have the opportunity to review your application in full before you submit it + title: Review your application — Application applying_for_the_job_heading: Applying for the job applying_for_the_job_paragraph: Please complete the online application. no_cvs: CVs are not accepted. diff --git a/config/locales/jobseekers/job_application/ask_for_support_form.yml b/config/locales/jobseekers/job_application/ask_for_support_form.yml new file mode 100644 index 0000000000..ccac5b5fc0 --- /dev/null +++ b/config/locales/jobseekers/job_application/ask_for_support_form.yml @@ -0,0 +1,28 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/ask_for_support_form: + attributes: + support_needed: + inclusion: Select yes if you would like interview support + support_needed_details: + blank: Give details about what support you might need + present: If you don't need support, extra information must be blank + ask_for_support_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_ask_for_support_form: + support_needed: Do you want to ask for support so that you can attend an interview? + ask_for_support_section_completed: Have you completed this section? + label: + jobseekers_job_application_ask_for_support_form: + support_needed_details: Tell us any information you think is relevant + support_needed_options: + "no": No, I do not need support + "yes": Yes, I would like to share some information about the support that I need + ask_for_support_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section + diff --git a/config/locales/jobseekers/job_application/declarations_form.yml b/config/locales/jobseekers/job_application/declarations_form.yml new file mode 100644 index 0000000000..e70a50231d --- /dev/null +++ b/config/locales/jobseekers/job_application/declarations_form.yml @@ -0,0 +1,39 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/declarations_form: + attributes: + close_relationships: + inclusion: Select yes if you have a close relationship with people within the organisation + close_relationships_details: + blank: Give details about any close relationships with people within the organisation + safeguarding_issue: + inclusion: Select yes if you have a safeguarding issue to declare + safeguarding_issue_details: + blank: Provide details about your safeguarding issue + declarations_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_declarations_form: + close_relationships: Do you have any family or close relationship with people within %{organisation}? + right_to_work_in_uk: Do you need Skilled Worker visa sponsorship? + safeguarding_issue: Do you want to declare any substantiated safeguarding issues, such as a criminal record or professional misconduct? + declarations_section_completed: Have you completed this section? + label: + jobseekers_job_application_declarations_form: + close_relationships_details: Please give details + close_relationships_options: + "no": "No" + "yes": "Yes" + declarations_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section + hint: + jobseekers_job_application_declarations_form: + right_to_work_in_uk_html: >- + You can find out whether you have the right to work in the UK on the + GOV.UK website (opens in new tab). You can apply for this role even if you do not have the + right to work in the UK. + diff --git a/config/locales/jobseekers/job_application/employment_history_form.yml b/config/locales/jobseekers/job_application/employment_history_form.yml new file mode 100644 index 0000000000..4822c2e154 --- /dev/null +++ b/config/locales/jobseekers/job_application/employment_history_form.yml @@ -0,0 +1,21 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/employment_history_form: + attributes: + employment_history_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_employment_history_form: + employment_history_section_completed: Have you completed this section? + label: + jobseekers_job_application_employment_history_form: + employment_history_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section + hint: + jobseekers_job_application_employment_history_form: + employment_history_section_completed: Ensure you've added all your employment history. + diff --git a/config/locales/jobseekers/job_application/equal_opportunites_form.yml b/config/locales/jobseekers/job_application/equal_opportunites_form.yml new file mode 100644 index 0000000000..0c3a08b139 --- /dev/null +++ b/config/locales/jobseekers/job_application/equal_opportunites_form.yml @@ -0,0 +1,93 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/equal_opportunities_form: + attributes: + age: + inclusion: Select an age range or ‘Prefer not to say’ + disability: + inclusion: Select yes if you consider yourself to have a disability + ethnicity: + inclusion: Select an ethnic group or ‘Prefer not to say’ + ethnicity_description: + blank: Describe your ethnic group + gender: + inclusion: Select a gender or ‘Prefer not to say’ + gender_description: + blank: Describe your gender identity + orientation: + inclusion: Select a sexual orientation or ‘Prefer not to say’ + orientation_description: + blank: Describe your sexual orientation + religion: + inclusion: Select a religion or ‘Prefer not to say’ + religion_description: + blank: Describe your religion or belief + equal_opportunities_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_equal_opportunities_form: + equal_opportunities_section_completed: Have you completed this section? + label: + jobseekers_job_application_equal_opportunities_form: + age_options: + under_twenty_five: Under 25 + twenty_five_to_twenty_nine: 25 to 29 + thirty_to_thirty_nine: 30 to 39 + forty_to_forty_nine: 40 to 49 + fifty_to_fifty_nine: 50 to 59 + sixty_and_over: 60 and over + prefer_not_to_say: Prefer not to say + disability_options: + "no": "No" + "yes": "Yes" + prefer_not_to_say: Prefer not to say + ethnicity_description_html: Please describe your ethnic group (optional field) + ethnicity_options: + asian: Asian or Asian British + black: Black African, Caribbean or Black British + mixed: Mixed or multiple ethnic group + other: Other ethnic group + prefer_not_to_say: Prefer not to say + white: White + gender_description_html: Please describe your gender identity (optional field) + gender_options: + man: Man + other: Other gender identity + prefer_not_to_say: Prefer not to say + woman: Woman + orientation_description_html: Please describe your sexual orientation (optional field) + orientation_options: + bisexual: Bisexual + gay_or_lesbian: Gay or lesbian + heterosexual: Heterosexual + other: Other sexual orientation + prefer_not_to_say: Prefer not to say + religion_description_html: Please describe your religion or belief (optional field) + religion_options: + buddhist: Buddhist + christian: Christian + hindu: Hindu + jewish: Jewish + muslim: Muslim + none: No religion, atheist or agnostic + other: Other religion or belief + prefer_not_to_say: Prefer not to say + sikh: Sikh + equal_opportunities_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section + hint: + jobseekers_job_application_equal_opportunities_form: + gender: If the options below do not reflect how you identify, please select ‘Other gender identity’. + ethnicity: If the options below do not reflect how you identify, please select ‘Other ethnic group’. + ethnicity_options: + asian: Includes Indian, Pakistani, Bangladeshi or Chinese + mixed: Includes White and Black Caribbean, White and Black African or White and Asian + white: Includes English, Welsh, Scottish, Northern Irish, British, Irish Gypsy or Irish Traveller + orientation: If the options below do not reflect how you identify, please select ‘Other sexual orientation’. + religion: >- + You can select ‘Other religion or belief’ if your beliefs are not represented by one of the given options. + diff --git a/config/locales/jobseekers/job_application/personal_details_form.yml b/config/locales/jobseekers/job_application/personal_details_form.yml new file mode 100644 index 0000000000..5c1a3ad2c6 --- /dev/null +++ b/config/locales/jobseekers/job_application/personal_details_form.yml @@ -0,0 +1,68 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/personal_details_form: + attributes: + city: + blank: Enter your town or city + country: + blank: Enter your country + email_address: + blank: Enter your email address + invalid: Enter a valid email address in the correct format, like name@example.com + first_name: + blank: Enter your first name + last_name: + blank: Enter your last name + national_insurance_number: + invalid: Enter a National Insurance number in the correct format + phone_number: + blank: Enter your phone number + invalid: Enter a phone number in the correct format + postcode: + blank: Enter your postcode + street_address: + blank: Enter your building and street + teacher_reference_number: + invalid: Enter a teacher reference number (TRN) that is 7 digits long + right_to_work_in_uk: + inclusion: Select no if you have the right to work in the UK + has_ni_number: + inclusion: Select yes if you have a National Insurance number + personal_details_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_personal_details_form: + your_address: Your address + has_ni_number: Do you have a national insurance number? + personal_details_section_completed: Have you completed this section? + label: + jobseekers_job_application_personal_details_form: + city: Town or city + country: Country + email_address: Email address + first_name: First name + last_name: Last name + national_insurance_number_review: National Insurance number + national_insurance_number: What is your National Insurance number? + phone_number: Phone number + previous_names_review: Previous names + previous_names_html: Previous names (optional field) + street_address: Building and street + teacher_reference_number_review: Teacher reference number (TRN) + teacher_reference_number_html: Teacher reference number (TRN) (optional field) + has_ni_number_options: + "yes": "Yes" + "no": No, I do not have one or do not want to provide it yet + personal_details_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section + hint: + jobseekers_job_application_personal_details_form: + has_ni_number: >- + You can find this on your National Insurance card, + benefit letter, payslip or P60. It's made up of 2 letters, 6 numbers and a final letter. + phone_number: Enter a phone number you are happy to be contacted on. For example, 01632 960 001, 07700 900 982 or +44 0808 157 0192. + previous_names: For example maiden name or name at birth, if different from the name you have now. diff --git a/config/locales/jobseekers/job_application/personal_statement_form.yml b/config/locales/jobseekers/job_application/personal_statement_form.yml new file mode 100644 index 0000000000..86ccb411a3 --- /dev/null +++ b/config/locales/jobseekers/job_application/personal_statement_form.yml @@ -0,0 +1,20 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/personal_statement_form: + attributes: + personal_statement: + blank: Enter your personal statement + personal_statement_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_personal_statement_form: + personal_statement_section_completed: Have you completed this section? + label: + jobseekers_job_application_personal_statement_form: + personal_statement: Your personal statement + personal_statement_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section diff --git a/config/locales/jobseekers/job_application/professional_status_form.yml b/config/locales/jobseekers/job_application/professional_status_form.yml new file mode 100644 index 0000000000..ac6775f2d8 --- /dev/null +++ b/config/locales/jobseekers/job_application/professional_status_form.yml @@ -0,0 +1,52 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/professional_status_form: + attributes: + qualified_teacher_status: + inclusion: Select yes if you have qualified teacher status + qualified_teacher_status_year: + less_than_or_equal_to: The year your QTS was awarded must be the current year or in the past + not_a_number: Enter the year your QTS was awarded + teacher_reference_number: + invalid: Enter a teacher reference number (TRN) that is 7 digits long + blank: Enter a teacher reference number (TRN) that is 7 digits long + has_teacher_reference_number: + inclusion: Select yes and enter your teacher reference number (TRN). All teachers with QTS have a 7 digit TRN. + statutory_induction_complete: + inclusion: Select yes if you have completed your statutory induction year + professional_status_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_professional_status_form: + has_teacher_reference_number: "Do you have a teacher reference number (TRN)?" + has_teacher_reference_number_options: + "yes": "Yes" + "no": "No" + teacher_reference_number: What is your teacher reference number (TRN)? + statutory_induction_complete: Have you completed your statutory induction period? + qualified_teacher_status: Do you have qualified teacher status (QTS)? + professional_status_section_completed: Have you completed this section? + label: + jobseekers_job_application_professional_status_form: + qualified_teacher_status_details_html: Please provide more detail (optional field) + qualified_teacher_status_options: + "no": "No" + on_track: I'm on track to receive my QTS + non_teacher: I'm not looking for a teaching job + "yes": "Yes" + statutory_induction_complete_options: + "no": "No" + on_track: I'm on track to complete it + "yes": "Yes, I have completed a 1 or 2 year induction period" + qualified_teacher_status_year: Year QTS was awarded + hint: You're unlikely to get a teaching job in England unless you have QTS. Find out %{link}. + link_text: how to get QTS + professional_status_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section + hint: + jobseekers_job_application_professional_status_form: + statutory_induction_complete: New teachers before 2021 had to complete a 1 year statutory induction period. New teachers after 2021 have to complete a 2 year statutory induction period. diff --git a/config/locales/jobseekers/job_application/qualifications_form.yml b/config/locales/jobseekers/job_application/qualifications_form.yml new file mode 100644 index 0000000000..d9a765e446 --- /dev/null +++ b/config/locales/jobseekers/job_application/qualifications_form.yml @@ -0,0 +1,18 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/qualifications_form: + attributes: + qualifications_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_qualifications_form: + qualifications_section_completed: Have you completed this section? + label: + jobseekers_job_application_qualifications_form: + qualifications_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section + diff --git a/config/locales/jobseekers/job_application/references_form.yml b/config/locales/jobseekers/job_application/references_form.yml new file mode 100644 index 0000000000..97519cd641 --- /dev/null +++ b/config/locales/jobseekers/job_application/references_form.yml @@ -0,0 +1,17 @@ +en: + activemodel: + errors: + models: + jobseekers/job_application/references_form: + attributes: + references_section_completed: + inclusion: Select yes if you have completed this section + helpers: + legend: + jobseekers_job_application_references_form: + references_section_completed: Have you completed this section? + label: + jobseekers_job_application_references_form: + references_section_completed_options: + false: No, I'll come back to it later + true: Yes, I've completed this section diff --git a/config/routes.rb b/config/routes.rb index 8dd5bec012..f0d5148b16 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -95,6 +95,8 @@ end resources :references, only: %i[new create edit update destroy], controller: "job_applications/references" resources :training_and_cpds, only: %i[new create edit update destroy], controller: "job_applications/training_and_cpds" + get :apply + post :pre_submit get :review get :confirm_destroy get :confirm_withdraw diff --git a/spec/components/job_application_review_component_spec.rb b/spec/components/job_application_review_component_spec.rb index 35dca106d3..d544ce4b32 100644 --- a/spec/components/job_application_review_component_spec.rb +++ b/spec/components/job_application_review_component_spec.rb @@ -5,20 +5,10 @@ let(:args) { [job_application] } let(:kwargs) do - { - show_tracks: show_tracks, - step_process: step_process, - } + {} end let(:job_application) { create(:job_application) } - let(:show_tracks) { nil } - let(:step_process) do - Jobseekers::JobApplications::JobApplicationStepProcess.new( - :review, - job_application: job_application, - ) - end it_behaves_like ReviewComponent @@ -39,27 +29,10 @@ it "renders each section as part of a task list, between 'above' and 'below'" do expect(page).to have_css("ul.review-component__sections") - expect(page).to have_css("ul.review-component__sections li", count: 2) + # The 'action' element on each card has an 'li' element too + expect(page).to have_css("ul.review-component__sections li", count: 4) expect(page).to have_css("p#above + ul.review-component__sections") expect(page).to have_css("ul.review-component__sections + p#below") end end - - context "if 'train tracks' are on" do - let(:show_tracks) { true } - - it "renders the 'train tracks' component" do - render_inline(component) - expect(page).to have_css(".steps-component") - end - end - - context "if 'train tracks' are off" do - let(:show_tracks) { false } - - it "does not render the 'train tracks' component" do - render_inline(component) - expect(page).not_to have_css(".steps-component") - end - end end diff --git a/spec/components/job_listing_review_component/section_spec.rb b/spec/components/job_listing_review_component/section_spec.rb index 75febf67e3..9756ce1cca 100644 --- a/spec/components/job_listing_review_component/section_spec.rb +++ b/spec/components/job_listing_review_component/section_spec.rb @@ -49,34 +49,6 @@ end end - describe "The section heading" do - before do - render_inline(component) - end - - it "renders the heading component" do - expect(page).to have_css("li > ##{name} > .review-component__section__heading") - end - - it "renders the title" do - expect(page).to have_css( - ".review-component__section__heading > .review-component__section__heading__title > h3", - text: component.t("jobseekers.job_applications.build.personal_details.heading"), - ) - end - - it "renders a link to the form for that section" do - url = Rails.application.routes.url_helpers.jobseekers_job_application_build_path(job_application, :personal_details) - text = component.t("buttons.change") - - expect(page).to have_css(".review-component__section__heading a[href='#{url}']", text: text) - end - - it "renders a status tag as the content" do - expect(page).to have_css(".review-component__section__heading .review-component__section__heading__status .govuk-tag") - end - end - describe "The main list" do it "does not render the list by default" do render_inline(component) diff --git a/spec/factories/job_applications.rb b/spec/factories/job_applications.rb index 5e442f6c4c..57319af403 100644 --- a/spec/factories/job_applications.rb +++ b/spec/factories/job_applications.rb @@ -27,14 +27,6 @@ qualified_teacher_status_year { "1990" } statutory_induction_complete { "yes" } - # Education and qualifications - qualifications_section_completed { true } - - # Employment history - employment_history_section_completed { true } - - training_and_cpds_section_completed { true } - # Personal statement personal_statement { Faker::Lorem.paragraph(sentence_count: 8) } @@ -109,14 +101,6 @@ qualified_teacher_status_year { "" } statutory_induction_complete { "" } - # Education and qualifications - qualifications_section_completed { nil } - - # Employment history - employment_history_section_completed { nil } - - training_and_cpds_section_completed { nil } - # Personal statement personal_statement { "" } diff --git a/spec/form_models/jobseekers/job_application/ask_for_support_form_spec.rb b/spec/form_models/jobseekers/job_application/ask_for_support_form_spec.rb index 4b3d65f6d3..6bcf01cf56 100644 --- a/spec/form_models/jobseekers/job_application/ask_for_support_form_spec.rb +++ b/spec/form_models/jobseekers/job_application/ask_for_support_form_spec.rb @@ -1,6 +1,10 @@ require "rails_helper" RSpec.describe Jobseekers::JobApplication::AskForSupportForm, type: :model do + subject do + described_class.new(ask_for_support_section_completed: true) + end + it { is_expected.to validate_inclusion_of(:support_needed).in_array(%w[yes no]) } context "when support_needed is yes" do diff --git a/spec/form_models/jobseekers/job_application/declarations_form_spec.rb b/spec/form_models/jobseekers/job_application/declarations_form_spec.rb index cfb50555cf..a3a942f6d4 100644 --- a/spec/form_models/jobseekers/job_application/declarations_form_spec.rb +++ b/spec/form_models/jobseekers/job_application/declarations_form_spec.rb @@ -1,6 +1,10 @@ require "rails_helper" RSpec.describe Jobseekers::JobApplication::DeclarationsForm, type: :model do + subject do + described_class.new(declarations_section_completed: true) + end + it { is_expected.to validate_inclusion_of(:close_relationships).in_array(%w[yes no]) } context "when close_relationships is yes" do diff --git a/spec/form_models/jobseekers/job_application/employment_history_form_spec.rb b/spec/form_models/jobseekers/job_application/employment_history_form_spec.rb index a0f492da20..faa2b9a9e3 100644 --- a/spec/form_models/jobseekers/job_application/employment_history_form_spec.rb +++ b/spec/form_models/jobseekers/job_application/employment_history_form_spec.rb @@ -21,8 +21,6 @@ end describe "validations" do - it { is_expected.to validate_presence_of(:employment_history_section_completed) } - context "when employment history gaps are present" do it "adds errors for each unexplained gap" do expect(form).not_to be_valid diff --git a/spec/form_models/jobseekers/job_application/equal_opportunities_form_spec.rb b/spec/form_models/jobseekers/job_application/equal_opportunities_form_spec.rb index 1bc2e330a6..b001b676a0 100644 --- a/spec/form_models/jobseekers/job_application/equal_opportunities_form_spec.rb +++ b/spec/form_models/jobseekers/job_application/equal_opportunities_form_spec.rb @@ -1,6 +1,10 @@ require "rails_helper" RSpec.describe Jobseekers::JobApplication::EqualOpportunitiesForm, type: :model do + subject do + described_class.new(equal_opportunities_section_completed: true) + end + it { is_expected.to validate_inclusion_of(:disability).in_array(%w[no prefer_not_to_say yes]) } it { is_expected.to validate_inclusion_of(:age).in_array(%w[under_twenty_five twenty_five_to_twenty_nine thirty_to_thirty_nine forty_to_forty_nine fifty_to_fifty_nine sixty_and_over prefer_not_to_say]) } it { is_expected.to validate_inclusion_of(:gender).in_array(%w[man other prefer_not_to_say woman]) } diff --git a/spec/form_models/jobseekers/job_application/personal_details_form_spec.rb b/spec/form_models/jobseekers/job_application/personal_details_form_spec.rb index e449018bcc..37989adff8 100644 --- a/spec/form_models/jobseekers/job_application/personal_details_form_spec.rb +++ b/spec/form_models/jobseekers/job_application/personal_details_form_spec.rb @@ -1,6 +1,10 @@ require "rails_helper" RSpec.describe Jobseekers::JobApplication::PersonalDetailsForm, type: :model do + subject do + described_class.new(personal_details_section_completed: true) + end + let(:valid_params) do { city: "city", @@ -12,6 +16,7 @@ phone_number: "01234 12345678", email_address: "david@gmail.com", right_to_work_in_uk: "yes", + personal_details_section_completed: true, } end diff --git a/spec/form_models/jobseekers/job_application/personal_statement_form_spec.rb b/spec/form_models/jobseekers/job_application/personal_statement_form_spec.rb index 819469a993..a39d3bad3a 100644 --- a/spec/form_models/jobseekers/job_application/personal_statement_form_spec.rb +++ b/spec/form_models/jobseekers/job_application/personal_statement_form_spec.rb @@ -1,5 +1,9 @@ require "rails_helper" RSpec.describe Jobseekers::JobApplication::PersonalStatementForm, type: :model do + subject do + described_class.new(personal_statement_section_completed: true) + end + it { is_expected.to validate_presence_of(:personal_statement) } end diff --git a/spec/form_models/jobseekers/job_application/professional_status_form_spec.rb b/spec/form_models/jobseekers/job_application/professional_status_form_spec.rb index ec3eeb049f..3412cfb074 100644 --- a/spec/form_models/jobseekers/job_application/professional_status_form_spec.rb +++ b/spec/form_models/jobseekers/job_application/professional_status_form_spec.rb @@ -1,6 +1,10 @@ require "rails_helper" RSpec.describe Jobseekers::JobApplication::ProfessionalStatusForm, type: :model do + subject do + described_class.new(professional_status_section_completed: true) + end + it { is_expected.to validate_inclusion_of(:qualified_teacher_status).in_array(%w[yes no on_track]) } it { is_expected.to validate_inclusion_of(:statutory_induction_complete).in_array(%w[yes no on_track]) } diff --git a/spec/form_models/jobseekers/qualifications_form_spec.rb b/spec/form_models/jobseekers/qualifications_form_spec.rb deleted file mode 100644 index ee07284aca..0000000000 --- a/spec/form_models/jobseekers/qualifications_form_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require "rails_helper" - -RSpec.describe Jobseekers::JobApplication::QualificationsForm, type: :model do - it { is_expected.to validate_presence_of(:qualifications_section_completed) } -end diff --git a/spec/helpers/status_tag_helper_spec.rb b/spec/helpers/status_tag_helper_spec.rb index f724b6a779..157c711752 100644 --- a/spec/helpers/status_tag_helper_spec.rb +++ b/spec/helpers/status_tag_helper_spec.rb @@ -2,14 +2,13 @@ RSpec.describe StatusTagHelper do describe "#review_section_tag" do - subject { helper.review_section_tag(record, steps, form_classes) } + subject { helper.review_section_tag(record, form_classes) } context "when it is passed a job application" do let(:record) { build_stubbed(:job_application, completed_steps: %w[personal_details professional_status], in_progress_steps: %w[qualifications]) } - let(:form_classes) { [Jobseekers::JobApplication::PersonalDetailsForm] } context "when there is an error on the step's form object" do - let(:steps) { [:personal_details] } + let(:form_classes) { [Jobseekers::JobApplication::PersonalDetailsForm] } before { record.errors.add(:city) } @@ -19,7 +18,7 @@ end context "when the step has been completed" do - let(:steps) { [:personal_details] } + let(:form_classes) { [Jobseekers::JobApplication::PersonalDetailsForm] } it "returns 'complete' tag" do expect(subject).to eq(helper.govuk_tag(text: I18n.t("shared.status_tags.complete"), colour: "green")) @@ -27,7 +26,7 @@ end context "when the step has not been started" do - let(:steps) { [:personal_statement] } + let(:form_classes) { [Jobseekers::JobApplication::PersonalStatementForm] } it "returns 'not started' tag" do expect(subject).to eq(helper.govuk_tag(text: I18n.t("shared.status_tags.not_started"), colour: "grey")) @@ -35,7 +34,7 @@ end context "when the step is in progress" do - let(:steps) { [:qualifications] } + let(:form_classes) { [Jobseekers::JobApplication::QualificationsForm] } it "returns 'in progress' tag" do expect(subject).to eq(helper.govuk_tag(text: I18n.t("shared.status_tags.in_progress"), colour: "yellow")) diff --git a/spec/requests/jobseekers/job_applications/build_spec.rb b/spec/requests/jobseekers/job_applications/build_spec.rb index 63e77b9127..7623c58d2f 100644 --- a/spec/requests/jobseekers/job_applications/build_spec.rb +++ b/spec/requests/jobseekers/job_applications/build_spec.rb @@ -41,7 +41,7 @@ .to change { job_application.reload.first_name }.from("").to("Cool name") .and change { job_application.completed_steps }.from([]).to(["personal_details"]) - expect(response).to redirect_to(jobseekers_job_application_review_path(job_application)) + expect(response).to redirect_to(jobseekers_job_application_apply_path(job_application)) end end @@ -66,7 +66,7 @@ .to change { job_application.reload.first_name }.from("").to("Cool name") .and change { job_application.completed_steps }.from([]).to(["personal_details"]) - expect(response).to redirect_to(jobseekers_job_application_build_path(job_application, :professional_status)) + expect(response).to redirect_to(jobseekers_job_application_apply_path(job_application)) end end end diff --git a/spec/requests/jobseekers/job_applications_spec.rb b/spec/requests/jobseekers/job_applications_spec.rb index bd6d80d0b7..376fb87267 100644 --- a/spec/requests/jobseekers/job_applications_spec.rb +++ b/spec/requests/jobseekers/job_applications_spec.rb @@ -6,7 +6,7 @@ let(:jobseeker) { create(:jobseeker) } describe "GET #new" do - let!(:jobseeker_profile) { create(:jobseeker_profile, jobseeker: jobseeker) } + before { create(:jobseeker_profile, jobseeker: jobseeker) } context "when the jobseeker is not signed in" do before { get(new_jobseekers_job_job_application_path(vacancy.id)) } @@ -16,7 +16,7 @@ end end - context "when the jobseeker is signed in " do + context "when the jobseeker is signed in" do before { sign_in(jobseeker, scope: :jobseeker) } context "when the job is not live" do @@ -45,7 +45,7 @@ end context "when a non-draft job application already exists and the user does not have right to work in UK" do - let(:jobseeker_profile) { create(:jobseeker_profile, jobseeker: jobseeker) } + let(:jobseeker_profile) { JobseekerProfile.last } let!(:personal_details) { create(:personal_details, right_to_work_in_uk: false, jobseeker_profile: jobseeker_profile) } let(:job_application) { create(:job_application, :status_submitted, jobseeker: jobseeker, vacancy: vacancy) } let(:new_vacancy) { create(:vacancy, organisations: [build(:school)]) } @@ -118,7 +118,7 @@ .to change { jobseeker.job_applications.count }.by(1) expect(response) - .to redirect_to(jobseekers_job_application_build_path(jobseeker.job_applications.first.id, :personal_details)) + .to redirect_to(jobseekers_job_application_apply_path(jobseeker.job_applications.first)) end end @@ -223,7 +223,7 @@ .to change { jobseeker.job_applications.count }.by(1) expect(response) - .to redirect_to(jobseekers_job_application_review_path(jobseeker.job_applications.draft.first.id)) + .to redirect_to(jobseekers_job_application_apply_path(jobseeker.job_applications.draft.first.id)) end end end diff --git a/spec/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile_spec.rb b/spec/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile_spec.rb index 9ecc39524c..642470d527 100644 --- a/spec/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile_spec.rb +++ b/spec/services/jobseekers/job_applications/prefill_job_application_from_jobseeker_profile_spec.rb @@ -20,10 +20,6 @@ .to eq(jobseeker_profile.qualifications.map { |qualification| qualification.slice(*attributes_to_copy) }) end - it "sets qualifications section completed to false" do - expect(subject.qualifications_section_completed).to eq(false) - end - it "adds qualifications to in progress steps" do expect(subject.in_progress_steps).to include("qualifications") end @@ -35,10 +31,6 @@ .to eq(jobseeker_profile.employments.map { |employment| employment.slice(*attributes_to_copy) }) end - it "sets employment history section completed to false" do - expect(subject.employment_history_section_completed).to eq(false) - end - it "adds employment history to in progress steps" do expect(subject.in_progress_steps).to include("employment_history") end @@ -50,10 +42,6 @@ .to eq(jobseeker_profile.training_and_cpds.map { |training| training.slice(*attributes_to_copy) }) end - it "sets training and cpds section completed to false" do - expect(subject.training_and_cpds_section_completed).to eq(false) - end - it "adds training and cpds to in progress steps" do expect(subject.in_progress_steps).to include("training_and_cpds") end diff --git a/spec/services/jobseekers/job_applications/prefill_job_application_from_previous_application_spec.rb b/spec/services/jobseekers/job_applications/prefill_job_application_from_previous_application_spec.rb index 433830ae96..0c8477ac60 100644 --- a/spec/services/jobseekers/job_applications/prefill_job_application_from_previous_application_spec.rb +++ b/spec/services/jobseekers/job_applications/prefill_job_application_from_previous_application_spec.rb @@ -95,7 +95,7 @@ end it "sets qualifications section completed to true" do - expect(subject.qualifications_section_completed).to eq(true) + expect(subject.completed_steps).to(include("qualifications")) end it "copies employments from the recent job application" do @@ -113,13 +113,13 @@ end it "sets employment history section completed to false" do - expect(subject.employment_history_section_completed).to eq(false) + expect(subject.in_progress_steps).to(include("employment_history")) end end context "when the application is from after we added gap validation for employment history section" do it "sets employment history section completed to true" do - expect(subject.employment_history_section_completed).to eq(true) + expect(subject.completed_steps).to(include("employment_history")) end end @@ -136,7 +136,7 @@ expect(subject.training_and_cpds.map { |training| training.slice(*attributes_to_copy) }) .to eq(recent_job_application.training_and_cpds.map { |training| training.slice(*attributes_to_copy) }) - expect(subject.training_and_cpds_section_completed).to eq(true) + expect(subject.completed_steps).to include("training_and_cpds") end it "does not copy declarations attributes from the recent job application" do diff --git a/spec/support/jobseeker_helpers.rb b/spec/support/jobseeker_helpers.rb index 555630b4f0..dd7e28cd49 100644 --- a/spec/support/jobseeker_helpers.rb +++ b/spec/support/jobseeker_helpers.rb @@ -12,6 +12,7 @@ def select_qualification_category(category) def fill_in_ask_for_support choose "Yes", name: "jobseekers_job_application_ask_for_support_form[support_needed]" fill_in "Tell us any information you think is relevant", with: "Some details about support" + choose I18n.t("helpers.label.jobseekers_job_application_ask_for_support_form.ask_for_support_section_completed_options.true") end def fill_in_current_role(job_title: "The Best Teacher", start_month: "07", start_year: "2020") @@ -30,6 +31,7 @@ def fill_in_declarations fill_in "Please give details", with: "Some details of the relationship" choose "Yes, I want to share something" fill_in "Give any relevant information", with: "Criminal record" + choose I18n.t("helpers.label.jobseekers_job_application_declarations_form.declarations_section_completed_options.true") end def fill_in_employment_history(job_title: "The Best Teacher", start_month: "09", start_year: "2019", end_month: "07", end_year: "2020") @@ -68,6 +70,8 @@ def fill_in_equal_opportunities choose "Mixed", name: "jobseekers_job_application_equal_opportunities_form[ethnicity]" choose "Other", name: "jobseekers_job_application_equal_opportunities_form[religion]" fill_in strip_tags(I18n.t("helpers.label.jobseekers_job_application_equal_opportunities_form.religion_description_html")), with: "Jainism" + + choose I18n.t("helpers.label.jobseekers_job_application_equal_opportunities_form.equal_opportunities_section_completed_options.true") end def fill_in_personal_details @@ -82,10 +86,13 @@ def fill_in_personal_details choose I18n.t("jobseekers.profiles.personal_details.work.options.true") choose I18n.t("helpers.label.jobseekers_job_application_personal_details_form.has_ni_number_options.yes") fill_in I18n.t("helpers.label.jobseekers_job_application_personal_details_form.national_insurance_number"), with: "AB 12 12 12 A" + + choose I18n.t("helpers.label.jobseekers_job_application_personal_details_form.personal_details_section_completed_options.true") end def fill_in_personal_statement fill_in "Your personal statement", with: "A brilliant, glowing statement about your person" + choose I18n.t("helpers.label.jobseekers_job_application_personal_statement_form.personal_statement_section_completed_options.true") end def fill_in_professional_status @@ -94,6 +101,8 @@ def fill_in_professional_status choose "Yes", name: "jobseekers_job_application_professional_status_form[has_teacher_reference_number]" fill_in "What is your teacher reference number (TRN)?", with: "1234567" choose "Yes", name: "jobseekers_job_application_professional_status_form[statutory_induction_complete]" + + choose I18n.t("helpers.label.jobseekers_job_application_professional_status_form.professional_status_section_completed_options.true") end def fill_in_reference diff --git a/spec/support/vacancy_helpers.rb b/spec/support/vacancy_helpers.rb index cca204ba9e..dcd3e13fc1 100644 --- a/spec/support/vacancy_helpers.rb +++ b/spec/support/vacancy_helpers.rb @@ -283,7 +283,7 @@ def verify_vacancy_show_page_details(vacancy) if vacancy.enable_job_applications? sponsorship_inset_text = vacancy.visa_sponsorship_available ? "Skilled Worker visas can be sponsored." : "Visas cannot be sponsored" expect(page).to have_content sponsorship_inset_text - expect(page).to have_link(I18n.t("jobseekers.job_applications.apply"), href: new_jobseekers_job_job_application_path(vacancy.id)) + expect(page).to have_link(I18n.t("jobseekers.job_applications.apply.apply"), href: new_jobseekers_job_job_application_path(vacancy.id)) else expect(page).to have_content(I18n.t("jobs.apply_via_website")) expect(page).to have_link(I18n.t("jobs.apply"), href: vacancy.application_link) diff --git a/spec/system/jobseekers/job_applications_deadline_passed_spec.rb b/spec/system/jobseekers/job_applications_deadline_passed_spec.rb index 2d1ea8664b..7a98862aac 100644 --- a/spec/system/jobseekers/job_applications_deadline_passed_spec.rb +++ b/spec/system/jobseekers/job_applications_deadline_passed_spec.rb @@ -33,14 +33,13 @@ end it "has a link to view the application" do - expect(page).to have_link(job_application.vacancy.job_title, href: jobseekers_job_application_review_path(job_application)) + expect(page).to have_link(job_application.vacancy.job_title, href: jobseekers_job_application_apply_path(job_application)) end end describe "on the application page" do before do - visit jobseekers_job_applications_path - click_on job_application.vacancy.job_title + visit jobseekers_job_application_review_path(job_application) end it "has the application status of 'deadline passed'" do diff --git a/spec/system/jobseekers/jobseeker_applications_statuses_spec.rb b/spec/system/jobseekers/jobseeker_applications_statuses_spec.rb index b4405d8668..8fe9bc1c76 100644 --- a/spec/system/jobseekers/jobseeker_applications_statuses_spec.rb +++ b/spec/system/jobseekers/jobseeker_applications_statuses_spec.rb @@ -23,11 +23,11 @@ click_button "Start application" - expect(page).to have_css("#personal_details .review-component__section__heading__status", text: "in progress") - expect(page).to have_css("#professional_status .review-component__section__heading__status", text: "in progress") - expect(page).to have_css("#qualifications .review-component__section__heading__status", text: "in progress") - expect(page).to have_css("#training_and_cpds .review-component__section__heading__status", text: "in progress") - expect(page).to have_css("#employment_history .review-component__section__heading__status", text: "in progress") + expect(page).to have_css("#personal_details", text: "in progress") + expect(page).to have_css("#professional_status", text: "in progress") + expect(page).to have_css("#qualifications", text: "in progress") + expect(page).to have_css("#training_and_cpds", text: "in progress") + expect(page).to have_css("#employment_history", text: "in progress") end end @@ -42,11 +42,11 @@ click_button "Start application" - expect(page).to have_css("#personal_details .review-component__section__heading__status", text: "not started") - expect(page).to have_css("#professional_status .review-component__section__heading__status", text: "not started") - expect(page).to have_css("#qualifications .review-component__section__heading__status", text: "not started") - expect(page).to have_css("#training_and_cpds .review-component__section__heading__status", text: "not started") - expect(page).to have_css("#employment_history .review-component__section__heading__status", text: "not started") + expect(page).to have_css("#personal_details", text: "not started") + expect(page).to have_css("#professional_status", text: "not started") + expect(page).to have_css("#qualifications", text: "not started") + expect(page).to have_css("#training_and_cpds", text: "not started") + expect(page).to have_css("#employment_history", text: "not started") end end @@ -61,15 +61,15 @@ click_button "Start application" - expect(page).to have_css("#personal_details .review-component__section__heading__status", text: "not started") - expect(page).to have_css("#professional_status .review-component__section__heading__status", text: "not started") - expect(page).to have_css("#qualifications .review-component__section__heading__status", text: "in progress") - expect(page).to have_css("#training_and_cpds .review-component__section__heading__status", text: "not started") - expect(page).to have_css("#employment_history .review-component__section__heading__status", text: "in progress") + expect(page).to have_css("#personal_details", text: "not started") + expect(page).to have_css("#professional_status", text: "not started") + expect(page).to have_css("#qualifications", text: "in progress") + expect(page).to have_css("#training_and_cpds", text: "not started") + expect(page).to have_css("#employment_history", text: "in progress") end context "when the jobseeker completes a section" do - it "shows the section as complete" do + it "shows the section as complete", :js do visit job_path(vacancy) within ".banner-buttons" do click_on I18n.t("jobseekers.job_applications.banner_links.apply") @@ -78,43 +78,43 @@ click_button "Start application" within("#personal_details") do - click_link("Complete section") + click_link("Personal details") end fill_in_personal_details - click_on "Save" + click_on "Save and continue" - expect(page).to have_css("#personal_details .review-component__section__heading__status", text: "complete") + expect(page).to have_css("#personal_details", text: "complete") within("#professional_status") do - click_link("Complete section") + click_link("Professional status") end fill_in_professional_status - click_on "Save" + click_on "Save and continue" - expect(page).to have_css("#professional_status .review-component__section__heading__status", text: "complete") + expect(page).to have_css("#professional_status", text: "complete") within("#qualifications") do - click_link("Complete section") + click_link("Qualifications") end choose "Yes, I've completed this section" - click_on "Save" + click_on "Save and continue" - expect(page).to have_css("#qualifications .review-component__section__heading__status", text: "complete") + expect(page).to have_css("#qualifications", text: "complete") within("#training_and_cpds") do - click_link("Complete section") + click_link(I18n.t("jobseekers.job_applications.build.training_and_cpds.heading")) end choose "Yes, I've completed this section" - click_on "Save" + click_on "Save and continue" - expect(page).to have_css("#training_and_cpds .review-component__section__heading__status", text: "complete") + expect(page).to have_css("#training_and_cpds", text: "complete") within("#employment_history") do - click_link("Complete section") + click_link(I18n.t("jobseekers.job_applications.build.employment_history.heading")) end click_on "Add another job" @@ -122,9 +122,9 @@ click_on "Save role" choose "Yes, I've completed this section" - click_on "Save" + click_on "Save and continue" - expect(page).to have_css("#employment_history .review-component__section__heading__status", text: "complete") + expect(page).to have_css("#employment_history", text: "complete") end end end diff --git a/spec/system/jobseekers/jobseekers_can_add_declarations_to_their_job_application_spec.rb b/spec/system/jobseekers/jobseekers_can_add_declarations_to_their_job_application_spec.rb index 9820e51938..5b44db1a1e 100644 --- a/spec/system/jobseekers/jobseekers_can_add_declarations_to_their_job_application_spec.rb +++ b/spec/system/jobseekers/jobseekers_can_add_declarations_to_their_job_application_spec.rb @@ -11,6 +11,7 @@ it "allows jobseekers to add their declarations" do visit jobseekers_job_application_build_path(job_application, :declarations) + choose I18n.t("helpers.label.jobseekers_job_application_declarations_form.declarations_section_completed_options.true") click_on "Save and continue" diff --git a/spec/system/jobseekers/jobseekers_can_add_professional_status_to_their_job_application_spec.rb b/spec/system/jobseekers/jobseekers_can_add_professional_status_to_their_job_application_spec.rb index 9cf7034f51..0626292cf2 100644 --- a/spec/system/jobseekers/jobseekers_can_add_professional_status_to_their_job_application_spec.rb +++ b/spec/system/jobseekers/jobseekers_can_add_professional_status_to_their_job_application_spec.rb @@ -5,13 +5,15 @@ let(:vacancy) { create(:vacancy, organisations: [build(:school)]) } let!(:job_application) { create(:job_application, :status_draft, jobseeker: jobseeker, vacancy: vacancy) } - before { login_as(jobseeker, scope: :jobseeker) } + before do + login_as(jobseeker, scope: :jobseeker) + visit jobseekers_job_application_build_path(job_application, :professional_status) + choose I18n.t("helpers.label.jobseekers_job_application_professional_status_form.professional_status_section_completed_options.true") + end after { logout } it "allows jobseekers to add their professional status" do - visit jobseekers_job_application_build_path(job_application, :professional_status) - click_on "Save and continue" expect(page).to have_css("h2", text: "There is a problem") @@ -50,8 +52,6 @@ end it "creates a jobseeker profile if the jobseeker does not have one" do - visit jobseekers_job_application_build_path(job_application, :professional_status) - choose "Yes", name: "jobseekers_job_application_professional_status_form[qualified_teacher_status]" choose "Yes", name: "jobseekers_job_application_professional_status_form[qualified_teacher_status]" diff --git a/spec/system/jobseekers/jobseekers_can_add_references_to_their_job_application_spec.rb b/spec/system/jobseekers/jobseekers_can_add_references_to_their_job_application_spec.rb index d411f59fea..18f7dad593 100644 --- a/spec/system/jobseekers/jobseekers_can_add_references_to_their_job_application_spec.rb +++ b/spec/system/jobseekers/jobseekers_can_add_references_to_their_job_application_spec.rb @@ -53,10 +53,12 @@ click_on I18n.t("buttons.save_reference") expect(current_path).to eq(jobseekers_job_application_build_path(job_application, :references)) - expect(page).not_to have_content("John") - expect(page).not_to have_content("Yes") - expect(page).to have_content("Jason") - expect(page).to have_content("No") + within ".govuk-summary-card" do + expect(page).not_to have_content("John") + expect(page).not_to have_content("Yes") + expect(page).to have_content("Jason") + expect(page).to have_content("No") + end end end end diff --git a/spec/system/jobseekers/jobseekers_can_complete_a_job_application_spec.rb b/spec/system/jobseekers/jobseekers_can_complete_a_job_application_spec.rb index dbeefcaee0..bb852b62c1 100644 --- a/spec/system/jobseekers/jobseekers_can_complete_a_job_application_spec.rb +++ b/spec/system/jobseekers/jobseekers_can_complete_a_job_application_spec.rb @@ -19,17 +19,18 @@ fill_in_personal_details click_on I18n.t("buttons.save_and_continue") - expect(page).to have_content(I18n.t("jobseekers.job_applications.build.professional_status.heading")) + click_on(I18n.t("jobseekers.job_applications.build.professional_status.heading")) validates_step_complete fill_in_professional_status click_on I18n.t("buttons.save_and_continue") - expect(page).to have_content(I18n.t("jobseekers.job_applications.build.qualifications.heading")) + click_on(I18n.t("jobseekers.job_applications.build.qualifications.heading")) validates_step_complete choose I18n.t("helpers.label.jobseekers_job_application_qualifications_form.qualifications_section_completed_options.true") click_on I18n.t("buttons.save_and_continue") + expect(page).not_to have_content("There is a problem") - click_on I18n.t("buttons.back") + click_on(I18n.t("jobseekers.job_applications.build.qualifications.heading")) click_on I18n.t("buttons.add_qualification") validates_step_complete(button: I18n.t("buttons.continue")) select_qualification_category("Undergraduate degree") @@ -40,6 +41,7 @@ choose "Yes, I've completed this section" click_on I18n.t("buttons.save_and_continue") + click_on(I18n.t("jobseekers.job_applications.build.training_and_cpds.heading")) expect(page).to have_content("No training or CPD specified") validates_step_complete click_on "Add training" @@ -50,7 +52,7 @@ choose "Yes, I've completed this section" click_on "Save and continue" - expect(page).to have_content(I18n.t("jobseekers.job_applications.build.employment_history.heading")) + click_on(I18n.t("jobseekers.job_applications.build.employment_history.heading")) validates_step_complete click_on I18n.t("buttons.add_work_history") click_on I18n.t("buttons.save_employment") @@ -63,13 +65,12 @@ choose I18n.t("helpers.label.jobseekers_job_application_employment_history_form.employment_history_section_completed_options.true") click_on I18n.t("buttons.save_and_continue") - expect(page).to have_content(I18n.t("jobseekers.job_applications.build.personal_statement.heading")) + click_on(I18n.t("jobseekers.job_applications.build.personal_statement.heading")) validates_step_complete fill_in_personal_statement click_on I18n.t("buttons.save_and_continue") - expect(page).to have_content(I18n.t("jobseekers.job_applications.build.references.heading")) - expect(page).not_to have_content(I18n.t("buttons.save_and_continue")) + click_on(I18n.t("jobseekers.job_applications.build.references.heading")) click_on I18n.t("buttons.add_reference") click_on I18n.t("buttons.save_reference") expect(page).to have_content("There is a problem") @@ -78,22 +79,24 @@ click_on I18n.t("buttons.add_another_reference") fill_in_reference click_on I18n.t("buttons.save_reference") + choose I18n.t("helpers.label.jobseekers_job_application_references_form.references_section_completed_options.true") click_on I18n.t("buttons.save_and_continue") - expect(page).to have_content(I18n.t("jobseekers.job_applications.build.equal_opportunities.heading")) + click_on(I18n.t("jobseekers.job_applications.build.equal_opportunities.heading")) validates_step_complete fill_in_equal_opportunities click_on I18n.t("buttons.save_and_continue") - expect(page).to have_content(I18n.t("jobseekers.job_applications.build.ask_for_support.heading")) + click_on(I18n.t("jobseekers.job_applications.build.ask_for_support.heading")) validates_step_complete fill_in_ask_for_support click_on I18n.t("buttons.save_and_continue") - expect(page).to have_content(I18n.t("jobseekers.job_applications.build.declarations.heading")) + click_on(I18n.t("jobseekers.job_applications.build.declarations.heading")) validates_step_complete fill_in_declarations click_on I18n.t("buttons.save_and_continue") + click_on "Review application" expect(current_path).to eq(jobseekers_job_application_review_path(job_application)) end diff --git a/spec/system/jobseekers/jobseekers_can_manage_their_job_applications_spec.rb b/spec/system/jobseekers/jobseekers_can_manage_their_job_applications_spec.rb index e9722ef896..0dcc744aed 100644 --- a/spec/system/jobseekers/jobseekers_can_manage_their_job_applications_spec.rb +++ b/spec/system/jobseekers/jobseekers_can_manage_their_job_applications_spec.rb @@ -52,7 +52,7 @@ click_on draft_job_application.vacancy.job_title end - expect(current_path).to eq(jobseekers_job_application_review_path(draft_job_application)) + expect(current_path).to eq(jobseekers_job_application_apply_path(draft_job_application)) end it "can not continue a draft application that has passed the deadline" do diff --git a/spec/system/jobseekers/jobseekers_can_quick_apply_for_a_vacancy_spec.rb b/spec/system/jobseekers/jobseekers_can_quick_apply_for_a_vacancy_spec.rb index 1b593b6234..49cdb158ae 100644 --- a/spec/system/jobseekers/jobseekers_can_quick_apply_for_a_vacancy_spec.rb +++ b/spec/system/jobseekers/jobseekers_can_quick_apply_for_a_vacancy_spec.rb @@ -18,6 +18,6 @@ click_on I18n.t("buttons.start_application") - expect(current_path).to eq(jobseekers_job_application_review_path(jobseeker.job_applications.draft.first.id)) + expect(current_path).to eq(jobseekers_job_application_apply_path(jobseeker.job_applications.draft.first.id)) end end diff --git a/spec/system/jobseekers/jobseekers_can_start_a_job_application_spec.rb b/spec/system/jobseekers/jobseekers_can_start_a_job_application_spec.rb index bf2a91fa9f..9759cdef1c 100644 --- a/spec/system/jobseekers/jobseekers_can_start_a_job_application_spec.rb +++ b/spec/system/jobseekers/jobseekers_can_start_a_job_application_spec.rb @@ -27,7 +27,7 @@ expect { click_on I18n.t("buttons.start_application") }.to change { JobApplication.count }.by(1) - expect(current_path).to eq(jobseekers_job_application_build_path(created_job_application, :personal_details)) + expect(current_path).to eq(jobseekers_job_application_apply_path(created_job_application)) end end @@ -50,7 +50,7 @@ expect { click_on I18n.t("buttons.start_application") }.to change { JobApplication.count }.by(1) - expect(current_path).to eq(jobseekers_job_application_build_path(created_job_application, :personal_details)) + expect(current_path).to eq(jobseekers_job_application_apply_path(created_job_application)) end end end diff --git a/spec/system/jobseekers/jobseekers_can_update_their_profile_from_job_applications_spec.rb b/spec/system/jobseekers/jobseekers_can_update_their_profile_from_job_applications_spec.rb index e0e783f450..9f817ded49 100644 --- a/spec/system/jobseekers/jobseekers_can_update_their_profile_from_job_applications_spec.rb +++ b/spec/system/jobseekers/jobseekers_can_update_their_profile_from_job_applications_spec.rb @@ -7,7 +7,7 @@ let(:application_qualification) { create(:qualification, name: "Application qualification") } let(:application_employment) { create(:employment, job_title: "Application employment") } let(:application_training) { create(:training_and_cpd, name: "Application training") } - let(:job_application) { create(:job_application, jobseeker: jobseeker, vacancy: vacancy, qualifications: [application_qualification], employments: [application_employment], training_and_cpds: [application_training], training_and_cpds_section_completed: true) } + let(:job_application) { create(:job_application, jobseeker: jobseeker, vacancy: vacancy, qualifications: [application_qualification], employments: [application_employment], training_and_cpds: [application_training]) } context "when the jobseekers have a profile" do let(:jobseeker) { create(:jobseeker) } diff --git a/spec/system/jobseekers/prefilling_applications_spec.rb b/spec/system/jobseekers/prefilling_applications_spec.rb index 6b74bfcbdb..daaafb6085 100644 --- a/spec/system/jobseekers/prefilling_applications_spec.rb +++ b/spec/system/jobseekers/prefilling_applications_spec.rb @@ -14,6 +14,7 @@ context "when the jobseeker has a completed profile" do let(:profile) { create(:jobseeker_profile, :completed, qualified_teacher_status: "yes", qualified_teacher_status_year: "2020") } let(:jobseeker) { profile.jobseeker } + let(:current_job_application) { JobApplication.order(:created_at).last } context "and when the jobseeker also has a previous application" do let(:reference) { create(:reference, job_title: "Reference4Testing") } @@ -23,7 +24,7 @@ let(:qualification2) { create(:qualification) } let(:training) { create(:training_and_cpd) } let!(:previous_application) do - create(:job_application, :status_submitted, jobseeker:, qualified_teacher_status: "yes", qualified_teacher_status_year: "2020", + create(:job_application, :status_submitted, jobseeker:, qualified_teacher_status: "yes", qualified_teacher_status_year: "2020", created_at: 1.year.ago, references: [reference], employments: [employment1, employment2], qualifications: [qualification1, qualification2]) end @@ -38,38 +39,47 @@ expect(page).to have_content("Your details have been imported from your last job application.") - expect(page).to have_content(previous_application.first_name) - expect(page).to have_content(previous_application.last_name) - expect(page).to have_content(previous_application.phone_number) + expect(current_job_application.first_name).to eq(previous_application.first_name) + expect(current_job_application.last_name).to eq(previous_application.last_name) + expect(current_job_application.phone_number).to eq(previous_application.phone_number) within("#personal_details") do expect(page).to have_css("strong.govuk-tag.govuk-tag--blue", text: "imported") end + click_on "Personal statement" expect(page).to have_content(previous_application.personal_statement) - within("#personal_statement.review-component__section") do + click_on "Back" + within("#personal_statement") do expect(page).to have_css("strong.govuk-tag.govuk-tag--blue", text: "imported") end # qualified teacher status - expect(page).to have_content("Yes, awarded in 2020") + expect(current_job_application.qualified_teacher_status).to eq("yes") + expect(current_job_application.qualified_teacher_status_year).to eq("2020") # skilled worker visa sponsorship - expect(page).to have_content("No, I already have the right to work in the UK") + expect(current_job_application.right_to_work_in_uk).to eq("yes") + within("#professional_status") do expect(page).to have_css("strong.govuk-tag.govuk-tag--blue", text: "imported") end # references + click_on "References" expect(page).to have_content(reference.job_title) expect(page).to have_content(reference.organisation) expect(page).to have_content(reference.relationship) + click_on "Back" # work history + click_on "Work history" expect(page).to have_content(employment1.main_duties) expect(page).to have_content(employment1.organisation) expect(page).to have_content(employment2.main_duties) expect(page).to have_content(employment2.organisation) + click_on "Back" within("#employment_history") do expect(page).to have_css("strong.govuk-tag.govuk-tag--blue", text: "imported") end + click_on "Qualifications" previous_application.qualifications.each do |qualification| expect(page).to have_content(I18n.t("helpers.label.jobseekers_qualifications_category_form.category_options.#{qualification.category}")) expect(page).to have_content(qualification.institution) @@ -77,22 +87,27 @@ expect(page).to have_content("(#{qualification.grade})") end end + click_on "Back" within("#qualifications") do expect(page).to have_css("strong.govuk-tag.govuk-tag--blue", text: "imported") end + click_on I18n.t("jobseekers.job_applications.build.training_and_cpds.heading") expect(page).to have_content(training.name) expect(page).to have_content(training.provider) expect(page).to have_content(training.grade) expect(page).to have_content(training.year_awarded) + click_on "Back" within("#training_and_cpds") do expect(page).to have_css("strong.govuk-tag.govuk-tag--blue", text: "imported") end + click_on I18n.t("jobseekers.job_applications.build.ask_for_support.heading") expect(page).to have_content(previous_application.support_needed.capitalize) expect(page).to have_content(previous_application.support_needed_details) + click_on "Back" within("#ask_for_support") do expect(page).to have_css("strong.govuk-tag.govuk-tag--blue", text: "imported") end @@ -109,10 +124,13 @@ click_on I18n.t("buttons.start_application") - expect(page).to have_content(profile.personal_details.first_name) - expect(page).to have_content(profile.personal_details.last_name) - expect(page).to have_content(profile.personal_details.phone_number) - expect(page).to have_content(profile.qualified_teacher_status_year) + expect(current_job_application.first_name).to eq(profile.personal_details.first_name) + expect(current_job_application.last_name).to eq(profile.personal_details.last_name) + expect(current_job_application.phone_number).to eq(profile.personal_details.phone_number) + + expect(current_job_application.qualified_teacher_status_year).to eq(profile.qualified_teacher_status_year) + + click_on "Qualifications" expect(page).to have_content(profile.qualifications.first.institution) profile.qualifications.each do |qualification| expect(page).to have_content(I18n.t("helpers.label.jobseekers_qualifications_category_form.category_options.#{qualification.category}")) @@ -121,8 +139,12 @@ expect(page).to have_content("(#{qualification.grade})") end end + click_on "Back" + + click_on "Work history" expect(page).to have_content(profile.employments.first.job_title) expect(page).to have_content(profile.employments.first.subjects) + click_on "Back" end end end @@ -137,6 +159,7 @@ click_on I18n.t("buttons.start_application") + click_on "Personal details" expect(page).to have_field("jobseekers_job_application_personal_details_form[first_name]") expect(page.find("#jobseekers-job-application-personal-details-form-first-name-field").value).to be_blank end