Skip to content

Commit

Permalink
Update references to teaching authority fields
Browse files Browse the repository at this point in the history
The fields have been renamed so we need to update all the references to
these old fields.
  • Loading branch information
thomasleese committed Sep 5, 2023
1 parent b8a648f commit 7c8d30b
Show file tree
Hide file tree
Showing 15 changed files with 111 additions and 110 deletions.
24 changes: 11 additions & 13 deletions app/controllers/support_interface/countries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ def edit
eligibility_enabled: country.eligibility_enabled,
eligibility_skip_questions: country.eligibility_skip_questions,
has_regions: country.regions.count > 1,
other_information: country.other_information,
qualifications_information: country.qualifications_information,
region_names: country.regions.pluck(:name).join("\n"),
requires_preliminary_check: country.requires_preliminary_check,
sanction_information: country.sanction_information,
status_information: country.status_information,
teaching_authority_address: country.teaching_authority_address,
teaching_authority_certificate:
country.teaching_authority_certificate,
Expand All @@ -25,11 +28,6 @@ def edit
teaching_authority_name: country.teaching_authority_name,
teaching_authority_online_checker_url:
country.teaching_authority_online_checker_url,
teaching_authority_other: country.teaching_authority_other,
teaching_authority_sanction_information:
country.teaching_authority_sanction_information,
teaching_authority_status_information:
country.teaching_authority_status_information,
teaching_authority_websites_string:
country.teaching_authority_websites_string,
)
Expand Down Expand Up @@ -66,21 +64,21 @@ def country

def country_params
params.require(:support_interface_country_form).permit(
:has_regions,
:region_names,
:eligibility_enabled,
:eligibility_skip_questions,
:has_regions,
:other_information,
:qualifications_information,
:region_names,
:requires_preliminary_check,
:teaching_authority_name,
:sanction_information,
:status_information,
:teaching_authority_address,
:teaching_authority_emails_string,
:teaching_authority_websites_string,
:teaching_authority_certificate,
:teaching_authority_other,
:teaching_authority_sanction_information,
:teaching_authority_status_information,
:teaching_authority_emails_string,
:teaching_authority_name,
:teaching_authority_online_checker_url,
:teaching_authority_websites_string,
)
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/support_interface/regions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ def load_region
def region_params
params.require(:region).permit(
:application_form_skip_work_history,
:other_information,
:qualifications_information,
:reduced_evidence_accepted,
:requires_preliminary_check,
:sanction_check,
:sanction_information,
:status_check,
:status_information,
:teaching_authority_address,
:teaching_authority_certificate,
:teaching_authority_emails_string,
:teaching_authority_name,
:teaching_authority_online_checker_url,
:teaching_authority_other,
:teaching_authority_provides_written_statement,
:teaching_authority_requires_submission_email,
:teaching_authority_sanction_information,
:teaching_authority_status_information,
:teaching_authority_websites_string,
:written_statement_optional,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class RegistrationNumberController < BaseController

before_action :redirect_unless_application_form_is_draft
before_action :load_application_form
before_action :load_teaching_authority_other

def edit
@registration_number_form =
Expand All @@ -33,10 +32,5 @@ def registration_number_form_params
:registration_number,
)
end

def load_teaching_authority_other
@teaching_authority_other =
application_form.region.teaching_authority_other
end
end
end
12 changes: 6 additions & 6 deletions app/forms/support_interface/country_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ class SupportInterface::CountryForm
attribute :eligibility_enabled, :boolean
attribute :eligibility_skip_questions, :boolean
attribute :has_regions, :boolean
attribute :other_information, :string
attribute :qualifications_information, :string
attribute :region_names, :string
attribute :requires_preliminary_check, :boolean
attribute :sanction_information, :string
attribute :status_information, :string
attribute :teaching_authority_address, :string
attribute :teaching_authority_certificate, :string
attribute :teaching_authority_emails_string, :string
attribute :teaching_authority_name, :string
attribute :teaching_authority_online_checker_url, :string
attribute :teaching_authority_other, :string
attribute :teaching_authority_sanction_information, :string
attribute :teaching_authority_status_information, :string
attribute :teaching_authority_websites_string, :string

validates :eligibility_enabled, inclusion: { in: [true, false] }
Expand Down Expand Up @@ -53,16 +53,16 @@ def assign_country_attributes
country.assign_attributes(
eligibility_enabled:,
eligibility_skip_questions:,
other_information:,
qualifications_information:,
requires_preliminary_check:,
sanction_information:,
status_information:,
teaching_authority_address:,
teaching_authority_certificate:,
teaching_authority_emails_string:,
teaching_authority_name:,
teaching_authority_online_checker_url:,
teaching_authority_other:,
teaching_authority_sanction_information:,
teaching_authority_status_information:,
teaching_authority_websites_string:,
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,22 @@
<% end %>

<% if region.status_check_written? %>
<% if region.teaching_authority_status_information.present? %>
<%= raw GovukMarkdown.render(region.teaching_authority_status_information) %>
<% if region.status_information.present? %>
<%= raw GovukMarkdown.render(region.status_information) %>
<% end %>

<% if region.country.teaching_authority_status_information.present? %>
<%= raw GovukMarkdown.render(region.country.teaching_authority_status_information) %>
<% if region.country.status_information.present? %>
<%= raw GovukMarkdown.render(region.country.status_information) %>
<% end %>
<% end %>

<% if region.sanction_check_written? %>
<% if region.teaching_authority_sanction_information.present?%>
<%= raw GovukMarkdown.render(region.teaching_authority_sanction_information) %>
<% if region.sanction_information.present? %>
<%= raw GovukMarkdown.render(region.sanction_information) %>
<% end %>

<% if region.country.teaching_authority_sanction_information.present?%>
<%= raw GovukMarkdown.render(region.country.teaching_authority_sanction_information) %>
<% if region.country.sanction_information.present? %>
<%= raw GovukMarkdown.render(region.country.sanction_information) %>
<% end %>
<% end %>

Expand All @@ -109,32 +109,32 @@
<% end %>

<% if region.status_check_online? %>
<% if region.teaching_authority_status_information.present?%>
<%= raw GovukMarkdown.render(region.teaching_authority_status_information) %>
<% if region.status_information.present? %>
<%= raw GovukMarkdown.render(region.status_information) %>
<% end %>

<% if region.country.teaching_authority_status_information.present?%>
<%= raw GovukMarkdown.render(region.country.teaching_authority_status_information) %>
<% if region.country.status_information.present? %>
<%= raw GovukMarkdown.render(region.country.status_information) %>
<% end %>
<% end %>

<% if region.sanction_check_online? %>
<% if region.teaching_authority_sanction_information.present?%>
<%= raw GovukMarkdown.render(region.teaching_authority_sanction_information) %>
<% if region.sanction_information.present? %>
<%= raw GovukMarkdown.render(region.sanction_information) %>
<% end %>

<% if region.country.teaching_authority_sanction_information.present?%>
<%= raw GovukMarkdown.render(region.country.teaching_authority_sanction_information) %>
<% if region.country.sanction_information.present? %>
<%= raw GovukMarkdown.render(region.country.sanction_information) %>
<% end %>
<% end %>

<%# "Other" information %>

<% if region.teaching_authority_other.present? %>
<%= raw GovukMarkdown.render(region.teaching_authority_other) %>
<% if region.other_information.present? %>
<%= raw GovukMarkdown.render(region.other_information) %>
<% end %>

<% if region.country.teaching_authority_other.present?%>
<%= raw GovukMarkdown.render(region.country.teaching_authority_other) %>
<% if region.country.other_information.present? %>
<%= raw GovukMarkdown.render(region.country.other_information) %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<p class="govuk-body">Proof that you’re recognised as a teacher</p>
<p class="govuk-hint">Example: ‘TRCN will charge you a fee of ₦60,000 for providing the Letter of Professional standing. They’ll also need your QTS application reference number, as well as copies of your teaching documents.’</p>

<%= f.govuk_text_area :teaching_authority_sanction_information, label: { text: 'Sanction Information' }, rows: 5 %>
<%= f.govuk_text_area :teaching_authority_status_information, label: { text: 'Status Information' }, rows: 5 %>
<%= f.govuk_text_area :sanction_information, label: { text: 'Sanction Information' }, rows: 5 %>
<%= f.govuk_text_area :status_information, label: { text: 'Status Information' }, rows: 5 %>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<%= f.govuk_text_area :teaching_authority_emails_string, label: { text: "Email:" }, hint: { text: "One email per line (if more than one)" } %>
<%= f.govuk_text_area :teaching_authority_websites_string, label: { text: "Websites:" }, hint: { text: "One website per line (if more than one)" } %>
<%= f.govuk_text_field :teaching_authority_certificate, label: { text: "Name given to describe the Letter of Professional standing: " } %>
<%= f.govuk_text_area :teaching_authority_other, label: { text: "Teaching authority other" } %>
<%= f.govuk_text_area :other_information, label: { text: "Teaching authority other" } %>
<%= f.govuk_text_field :teaching_authority_online_checker_url, label: { text: "Online checker URL" } %>
33 changes: 19 additions & 14 deletions app/views/support_interface/countries/preview.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
<% if (diff_actions = @form.diff_actions).present? %>
<h3 class="govuk-heading-s">Regions</h3>

<div class="govuk-warning-text">
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
<strong class="govuk-warning-text__text">
<span class="govuk-warning-text__assistive">Warning</span>
This action is irreversible and could affect historic eligibility checks.
</strong>
</div>
<%= govuk_warning_text(text: "This action is irreversible and could affect historic eligibility checks.") %>

<ul class="govuk-list">
<% diff_actions.each do |action| %>
Expand Down Expand Up @@ -49,15 +43,26 @@

<%= render "shared/teaching_authority_contactable", contactable: @country %>

<% if @country.teaching_authority_other.present? %>
<%= raw GovukMarkdown.render(@country.teaching_authority_other) %>
<% end %>

<p class="govuk-body"><%= @country.teaching_authority_certificate %></p>

<p class="govuk-body"><%= @country.teaching_authority_online_checker_url %></p>
<% end %>

<% if @country.sanction_information_changed? %>
<h3 class="govuk-heading-s">Sanction information</h3>
<%= raw GovukMarkdown.render(@country.sanction_information) %>
<% end %>

<% if @country.status_information_changed? %>
<h3 class="govuk-heading-s">Status information</h3>
<%= raw GovukMarkdown.render(@country.status_information) %>
<% end %>

<% if @country.other_information_changed? %>
<h3 class="govuk-heading-s">Other information</h3>
<%= raw GovukMarkdown.render(@country.other_information) %>
<% end %>

<% if @country.qualifications_information_changed? %>
<h3 class="govuk-heading-s">Qualifications information</h3>
<%= raw GovukMarkdown.render(@country.qualifications_information) %>
Expand All @@ -67,17 +72,17 @@
<%= f.hidden_field :eligibility_enabled, value: @form.eligibility_enabled %>
<%= f.hidden_field :eligibility_skip_questions, value: @form.eligibility_skip_questions %>
<%= f.hidden_field :has_regions, value: @form.has_regions %>
<%= f.hidden_field :other_information, value: @form.other_information %>
<%= f.hidden_field :qualifications_information, value: @form.qualifications_information %>
<%= f.hidden_field :region_names, value: @form.region_names %>
<%= f.hidden_field :requires_preliminary_check, value: @form.requires_preliminary_check %>
<%= f.hidden_field :sanction_information, value: @form.sanction_information %>
<%= f.hidden_field :status_information, value: @form.status_information %>
<%= f.hidden_field :teaching_authority_address, value: @form.teaching_authority_address %>
<%= f.hidden_field :teaching_authority_certificate, value: @form.teaching_authority_certificate %>
<%= f.hidden_field :teaching_authority_emails_string, value: @form.teaching_authority_emails_string %>
<%= f.hidden_field :teaching_authority_name, value: @form.teaching_authority_name %>
<%= f.hidden_field :teaching_authority_online_checker_url, value: @form.teaching_authority_online_checker_url %>
<%= f.hidden_field :teaching_authority_other, value: @form.teaching_authority_other %>
<%= f.hidden_field :teaching_authority_sanction_information, value: @form.teaching_authority_sanction_information%>
<%= f.hidden_field :teaching_authority_status_information, value: @form.teaching_authority_status_information%>
<%= f.hidden_field :teaching_authority_websites_string, value: @form.teaching_authority_websites_string %>
<%= f.govuk_submit "Save", name: "preview", value: "false" %>
<% end %>
6 changes: 3 additions & 3 deletions app/views/support_interface/regions/preview.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@

<%= form_with model: [:support_interface, @region] do |f| %>
<%= f.hidden_field :application_form_skip_work_history, value: @region.application_form_skip_work_history %>
<%= f.hidden_field :other_information, value: @region.other_information %>
<%= f.hidden_field :qualifications_information, value: @region.qualifications_information %>
<%= f.hidden_field :reduced_evidence_accepted, value: @region.reduced_evidence_accepted %>
<%= f.hidden_field :requires_preliminary_check, value: @region.requires_preliminary_check %>
<%= f.hidden_field :sanction_check, value: @region.sanction_check %>
<%= f.hidden_field :sanction_information, value: @region.sanction_information %>
<%= f.hidden_field :status_check, value: @region.status_check %>
<%= f.hidden_field :status_information, value: @region.status_information %>
<%= f.hidden_field :teaching_authority_address, value: @region.teaching_authority_address %>
<%= f.hidden_field :teaching_authority_certificate, value: @region.teaching_authority_certificate %>
<%= f.hidden_field :teaching_authority_emails_string, value: @region.teaching_authority_emails_string %>
<%= f.hidden_field :teaching_authority_name, value: @region.teaching_authority_name %>
<%= f.hidden_field :teaching_authority_online_checker_url, value: @region.teaching_authority_online_checker_url %>
<%= f.hidden_field :teaching_authority_other, value: @region.teaching_authority_other %>
<%= f.hidden_field :teaching_authority_provides_written_statement, value: @region.teaching_authority_provides_written_statement %>
<%= f.hidden_field :teaching_authority_requires_submission_email, value: @region.teaching_authority_requires_submission_email %>
<%= f.hidden_field :teaching_authority_sanction_information, value: @region.teaching_authority_sanction_information%>
<%= f.hidden_field :teaching_authority_status_information, value: @region.teaching_authority_status_information%>
<%= f.hidden_field :teaching_authority_websites_string, value: @region.teaching_authority_websites_string %>
<%= f.hidden_field :written_statement_optional, value: @region.written_statement_optional %>
<%= f.govuk_submit "Save", name: "preview", value: "false" %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
<p class="govuk-body">Contact them directly and instruct them to send the document to <%= govuk_link_to t("service.email.verification"), %(mailto: #{t("service.email.verification")}) %>.</p>
<h2 class="govuk-heading-m">Important information about your <%= region_certificate_name(view_object.region) %></h2>
<p class="govuk-body">Once you've submitted your application, we’ll notify <%= region_teaching_authority_name(view_object.region) %> that you’ve applied for QTS. You do not need to contact us to get written confirmation of this.</p>
<% if view_object.region.teaching_authority_other.present? %>
<p class="govuk-body"><%= view_object.region.teaching_authority_other %></p>
<% elsif view_object.region.country.teaching_authority_other.present? %>
<p class="govuk-body"><%= view_object.region.country.teaching_authority_other %></p>

<% if view_object.region.other_information.present? %>
<%= raw GovukMarkdown.render(view_object.region.other_information) %>
<% end %>

<% if view_object.region.country.other_information.present? %>
<%= raw GovukMarkdown.render(view_object.region.country.other_information) %>
<% end %>

<p class="govuk-body">Once you’re satisfied that you understand your next steps, you can close this page.</p>
17 changes: 9 additions & 8 deletions app/views/teacher_interface/registration_number/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
<%= f.govuk_text_field :registration_number, label: { size: "l", tag: "h1" } %>

<% if @application_form.region.status_check_online? %>
<% if @application_form.region.teaching_authority_status_information.present?%>
<%= raw GovukMarkdown.render(@application_form.region.teaching_authority_status_information) %>
<% if @application_form.region.status_information.present? %>
<%= raw GovukMarkdown.render(@application_form.region.status_information) %>
<% end %>

<% if @application_form.region.country.teaching_authority_status_information.present?%>
<%= raw GovukMarkdown.render(@application_form.region.country.teaching_authority_status_information) %>
<% if @application_form.region.country.status_information.present? %>
<%= raw GovukMarkdown.render(@application_form.region.country.status_information) %>
<% end %>
<% end %>

<% if @application_form.region.sanction_check_online? %>
<% if @application_form.region.teaching_authority_sanction_information.present?%>
<%= raw GovukMarkdown.render(@application_form.region.teaching_authority_sanction_information) %>
<% if @application_form.region.sanction_information.present? %>
<%= raw GovukMarkdown.render(@application_form.region.sanction_information) %>
<% end %>

<% if @application_form.region.country.teaching_authority_sanction_information.present?%>
<%= raw GovukMarkdown.render(@application_form.region.country.teaching_authority_sanction_information) %>
<% if @application_form.region.country.sanction_information.present? %>
<%= raw GovukMarkdown.render(@application_form.region.country.sanction_information) %>
<% end %>
<% end %>

Expand All @@ -32,5 +32,6 @@
contact you for more information as part of your application.
</p>
<% end %>

<%= render "shared/save_submit_buttons", f: %>
<% end %>
Loading

0 comments on commit 7c8d30b

Please sign in to comment.