Sha256: 76a65372c25694d3b6e8c18144b610563278cfa897f307fee14740e0883453b3

Contents?: true

Size: 1.57 KB

Versions: 72

Compression:

Stored size: 1.57 KB

Contents

<%
  add_gem_component_stylesheet("select")

  # select_helper.css_classes generates "gem-c-select"
  id ||= false
  label ||= false
  name ||= id
  is_page_heading ||= false

  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
  heading_size = false unless shared_helper.valid_heading_size?(heading_size)
  select_helper = GovukPublishingComponents::Presenters::SelectHelper.new(local_assigns)

  aria_describedby = { describedby: select_helper.describedby }
  data_module = { module: "track-select-change" } unless select_helper.data_tracking?.eql?(false)
%>
<% if select_helper.options.any? && id && label %>
  <%= content_tag :div, class: select_helper.css_classes do %>
    <% if is_page_heading %>
      <% add_gem_component_stylesheet("title") %>
      <%= tag.h1 label_tag(id, label, class: select_helper.label_classes), class: "gem-c-title__text" %>
    <% else %>
      <%= label_tag(id, label, class: select_helper.label_classes) %>
    <% end %>

    <% if select_helper.hint %>
      <%= render "govuk_publishing_components/components/hint", {
        id: select_helper.hint_id,
        text: hint
      } %>
    <% end %>

    <% if select_helper.error_message %>
      <%= render "govuk_publishing_components/components/error_message", {
        id: select_helper.error_id,
        text: select_helper.error_message
      } %>
    <% end %>

    <%= select_tag name, options_for_select(select_helper.option_markup, select_helper.selected_option), id: id, class: select_helper.select_classes, data: data_module, aria: aria_describedby %>
  <% end %>
<% end %>

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
govuk_publishing_components-35.15.1 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.15.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.14.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.13.2 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.13.1 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.13.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.12.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.11.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.10.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.9.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.8.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-35.7.0 app/views/govuk_publishing_components/components/_select.html.erb