32 changed files with 482 additions and 163 deletions
@ -1,10 +0,0 @@ |
|||||||
module Validations::SubmissionValidations |
|
||||||
# Validations methods need to be called 'validate_<page_name>' to run on model save |
|
||||||
# or 'validate_' to run on submit as well |
|
||||||
|
|
||||||
def validate_declaration(record) |
|
||||||
if record.declaration&.zero? |
|
||||||
record.errors.add :declaration, I18n.t("validations.declaration.missing") |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
@ -1,13 +1,18 @@ |
|||||||
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> |
<%= render partial: "form/guidance/#{question.guidance_partial}" if question.guidance_partial %> |
||||||
|
|
||||||
<% selected = @case_log.public_send(question.id) || "" %> |
<% selected = @case_log.public_send(question.id) || "" %> |
||||||
<% answers = question.displayed_answer_options(@case_log).map { |key, value| OpenStruct.new(id: key, name: value) } %> |
<% answers = question.displayed_answer_options(@case_log).map { |key, value| OpenStruct.new(id: key, name: value.respond_to?(:service_name) ? value.service_name : nil, resource: value) } %> |
||||||
<%= f.govuk_collection_select question.id.to_sym, |
<%= f.govuk_select(question.id.to_sym, |
||||||
answers, |
|
||||||
:id, |
|
||||||
:name, |
|
||||||
caption: caption(caption_text, page_header, conditional), |
|
||||||
label: legend(question, page_header, conditional), |
label: legend(question, page_header, conditional), |
||||||
hint: { text: question.hint_text&.html_safe }, |
"data-controller": "accessible-autocomplete", |
||||||
options: { disabled: [""], selected: }, |
caption: caption(caption_text, page_header, conditional), |
||||||
"data-controller": "accessible-autocomplete" %> |
hint: { text: question.hint_text&.html_safe }) do %> |
||||||
|
<% answers.each do |answer| %> |
||||||
|
<option value="<%= answer.id %>" |
||||||
|
data-synonyms="<%= question.answer_option_synonyms(answer.resource) %>" |
||||||
|
data-append="<%= question.answer_option_append(answer.resource) %>" |
||||||
|
data-hint="<%= question.answer_option_hint(answer.resource) %>" |
||||||
|
<%= @case_log[question.id] == answer.name || @case_log[question.id] == answer.resource || @case_log[question.id].to_s == answer.id ? "selected" : "" %> |
||||||
|
<%= answer.id == "" ? "disabled" : "" %>><%= answer.name || answer.resource %></option> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
@ -0,0 +1,7 @@ |
|||||||
|
class AddLocationStartdate < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
change_table :locations, bulk: true do |t| |
||||||
|
t.column :startdate, :datetime |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue