Sha256: c2d4a28c2d0a6a26f4542de207d5c07fcc925735bf0d7ee0194860c24afd0db4

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

<%
  add_gem_component_stylesheet("heading")

  brand ||= false
  lang = local_assigns[:lang].presence
  context ||= false
  context_locale ||= false
  context_inside ||= false

  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
  heading_helper = GovukPublishingComponents::Presenters::HeadingHelper.new(local_assigns)
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)

  component_helper.add_class("gem-c-heading")
  component_helper.add_class(heading_helper.classes)
  component_helper.add_class(brand_helper.brand_class)
  component_helper.add_class(brand_helper.border_color_class)
  component_helper.set_id(heading_helper.id)
%>
<% context_block = capture do %>
  <span class="govuk-caption-xl gem-c-heading__context" <%= "lang=#{context_locale}" if context_locale.present? %>>
    <%= context %>
  </span>
<% end %>

<%= tag.div(**component_helper.all_attributes) do %>
  <% if context && !context_inside %>
    <%= context_block %>
  <% end %>

  <%= content_tag(shared_helper.get_heading_level, class: heading_helper.heading_classes) do %>
    <% if context && context_inside %>
      <%= context_block %>
    <% end %>
    <%= text %>
  <% end %>
<% end %>

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
govuk_publishing_components-51.1.0 app/views/govuk_publishing_components/components/_heading.html.erb
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/_heading.html.erb
govuk_publishing_components-50.0.1 app/views/govuk_publishing_components/components/_heading.html.erb
govuk_publishing_components-50.0.0 app/views/govuk_publishing_components/components/_heading.html.erb
govuk_publishing_components-49.1.0 app/views/govuk_publishing_components/components/_heading.html.erb
govuk_publishing_components-49.0.0 app/views/govuk_publishing_components/components/_heading.html.erb
govuk_publishing_components-48.0.0 app/views/govuk_publishing_components/components/_heading.html.erb
govuk_publishing_components-47.0.0 app/views/govuk_publishing_components/components/_heading.html.erb