-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a hidden input for hidden facets
This replaces the use of an input[type=text] for a hidden field. The motivation for replacing this is that these depend on inline styles and these will no longer be permitted by the Content Security Policy in alphagov/govuk_app_config#279 This also serves as a semantic improvement to the HTML.
- Loading branch information
Showing
2 changed files
with
10 additions
and
10 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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<div id="<%= hidden_clearable_facet.key %>" style="display: none"> | ||
<% | ||
key = hidden_clearable_facet.key | ||
values = params[key] | ||
key = "#{key}[]" if values.is_a?(Array) | ||
-%> | ||
<% [values].flatten.each_with_index do |value, index| -%> | ||
<div id="<%= hidden_clearable_facet.key %>"> | ||
<% | ||
key = hidden_clearable_facet.key | ||
values = params[key] | ||
key = "#{key}[]" if values.is_a?(Array) | ||
-%> | ||
<% [values].flatten.each_with_index do |value, index| -%> | ||
|
||
|
||
<%= text_field_tag key, value, id: "#{hidden_clearable_facet.key}_#{index}" %> | ||
<% end -%> | ||
<%= hidden_field_tag key, value, id: "#{hidden_clearable_facet.key}_#{index}" %> | ||
<% end -%> | ||
</div> |