app/views/components/_govuk_select.html.erb in govuk-design-system-rails-0.10.1 vs app/views/components/_govuk_select.html.erb in govuk-design-system-rails-0.10.2

- old
+ new

@@ -26,36 +26,37 @@ govukLabel( html: local_assigns[:label].try(:[], :html), text: local_assigns[:label].try(:[], :text), classes: local_assigns[:label].try(:[], :classes), attributes: local_assigns[:label].try(:[], :attributes), - for: local_assigns[:id]) + for: local_assigns[:id] + ) %> <% if local_assigns[:hint] %> <% - hint_id = local_assigns.try(:[], :name) + '-hint' - described_by = described_by.present? ? described_by + ' ' + hint_id : hint_id + hint_id = "#{local_assigns.try(:[], :name)}-hint" + described_by = described_by.present? ? "#{described_by} #{hint_id}" : hint_id hint_classes = class_names( "govuk-hint", local_assigns[:hint][:classes] ) %> <%= govukHint({ - id: hint_id, - classes: hint_classes, - attributes: local_assigns[:hint][:attributes], - html: local_assigns[:hint][:html], - text: local_assigns[:hint][:text] - }) %> + id: hint_id, + classes: hint_classes, + attributes: local_assigns[:hint][:attributes], + html: local_assigns[:hint][:html], + text: local_assigns[:hint][:text] + }) %> <% end %> <% if local_assigns[:errorMessage] %> <% - error_id = local_assigns.try(:[], :name) + '-error' + error_id = "#{local_assigns.try(:[], :name)}-error" described_by = described_by.blank? ? error_id : "#{described_by} #{error_id}" - error_attributes = (local_assigns[:errorMessage][:attributes] || {}).merge(id: error_id) + error_attributes = (local_assigns[:errorMessage][:attributes] || {}).merge(id: error_id) %> <%= govukErrorMessage({ id: error_id, classes: local_assigns[:errorMessage][:classes], @@ -93,12 +94,14 @@ <svg class="autocomplete__clear-viewbox" viewbox="0 0 40 40"> <path class="autocomplete__clear-icon" d="M 10,10 L 30,30 M 30,10 L 10,30"></path> </svg> </button> <% end %> - <%= javascript_tag nonce: true do -%> - window.callAutocompleteWhenReady("<%= local_assigns[:id] %>", {showAllValues: "<%= local_assigns[:show_all_values] %>"}); - <% end -%> + <script nonce="true"> + //<![CDATA[ + window.callAutocompleteWhenReady(<%= local_assigns[:id].to_json %>, { showAllValues: <%= local_assigns[:show_all_values].to_json %> }); + //]]> + </script> <% else %> <%= select %> <% end %> <% end %>