Sha256: 8ea82efbd50d9c324dd846b8d4f323cef69573641651fbdf3d2800c6dbc8014e

Contents?: true

Size: 1.46 KB

Versions: 42

Compression:

Stored size: 1.46 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 }
%>
<% 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, aria: aria_describedby %>
  <% end %>
<% end %>

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
govuk_publishing_components-45.7.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.6.1 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.6.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.5.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.4.1 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.4.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.3.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.2.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.1.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-45.0.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.11.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.10.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.9.1 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.9.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.8.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.7.1 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.7.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.6.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.5.0 app/views/govuk_publishing_components/components/_select.html.erb
govuk_publishing_components-44.4.2 app/views/govuk_publishing_components/components/_select.html.erb