-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename datetime fields to match legacy form
There is some code in `ApplicationController#squash_multiparameter_datetime_attributes` that combines the date time form parameters used by the legacy view into a single parameter for use within the controller. To make use of this code without having to modify it, change the field names on the new form to match those of the old.
- Loading branch information
1 parent
3a7f3af
commit 5c28af1
Showing
4 changed files
with
158 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<% | ||
date_legend_text ||= nil | ||
time_legend_text ||= nil | ||
|
||
year ||= nil | ||
month ||= nil | ||
day ||= nil | ||
date_input_items = [] | ||
date_input_items << day if day | ||
date_input_items << month if month | ||
date_input_items << year if year | ||
date_input_items = nil unless date_input_items.any? | ||
|
||
hour ||= nil | ||
minute ||= nil | ||
time_input_items = [] | ||
time_input_items << hour if hour | ||
time_input_items << minute if minute | ||
time_input_items = nil unless time_input_items.any? | ||
%> | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full"> | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-one-half"> | ||
<%= render "govuk_publishing_components/components/fieldset", { | ||
legend_text: date_legend_text, | ||
heading_size: "m" | ||
} do %> | ||
<%= render "govuk_publishing_components/components/date_input", { | ||
hint: "For example, 01 08 2022", | ||
items: date_input_items, | ||
} %> | ||
<% end %> | ||
</div> | ||
<div class="govuk-grid-column-one-half"> | ||
<%= render "govuk_publishing_components/components/fieldset", { | ||
legend_text: time_legend_text, | ||
heading_size: "m" | ||
} do %> | ||
<%= render "time_input", { | ||
hint: "For example, 9:30 or 19:30", | ||
items: time_input_items, | ||
} %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.