Sha256: d9cf190d63415c267c3aa02f57424e9e9e2ac2a22081b1bbb498816adc1f6037
Contents?: true
Size: 1.4 KB
Versions: 83
Compression:
Stored size: 1.4 KB
Contents
<% options ||= [] id ||= false label ||= false full_width ||= false name ||= id heading_size = false unless ['s', 'm', 'l', 'xl'].include?(heading_size) error_message ||= nil error_id ||= nil if error_message || error_id error_id = "error-#{SecureRandom.hex(4)}" unless error_id aria_describedby = { describedby: error_id } end css_classes = %w(govuk-form-group gem-c-select) css_classes << "govuk-form-group--error" if error_message select_classes = %w(govuk-select) select_classes << "gem-c-select__select--full-width" if full_width select_classes << "govuk-select--error" if error_id label_classes = %w(govuk-label) label_classes << "govuk-label--#{heading_size}" if heading_size select_helper = GovukPublishingComponents::Presenters::SelectHelper.new(options) data_module = { module: "track-select-change" } unless select_helper.data_tracking?.eql?(false) %> <% if options.any? && id && label %> <%= content_tag :div, class: css_classes do %> <%= label_tag(id, label, class: label_classes) %> <% if error_message %> <%= render "govuk_publishing_components/components/error_message", { id: error_id, text: error_message } %> <% end %> <%= select_tag name, options_for_select(select_helper.option_markup, select_helper.selected_option), id: id, class: select_classes, data: data_module, aria: aria_describedby %> <% end %> <% end %>
Version data entries
83 entries across 83 versions & 1 rubygems