Sha256: 0d9760aa7c103d0a92a9d9d8c2ef61c91c511d28d14877759e5e57793729aa4f

Contents?: true

Size: 1.36 KB

Versions: 21

Compression:

Stored size: 1.36 KB

Contents

<%
  logo_helper = GovukPublishingComponents::Presenters::OrganisationLogoHelper.new(local_assigns)
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(organisation[:brand])

  organisation ||= {}
  heading_level ||= false
  inline ||= false

  # Check if `heading_level` is a number; if so, check if it's an appropriate
  # number.
  use_heading = heading_level.is_a?(Integer) ?
                  (heading_level >= 1 && heading_level <= 6) :
                  false

  # Set the wrapping element to be a heading or a `div`
  wrapping_element = use_heading ? "h#{heading_level}" : "div"

  wrapper_classes = %w(gem-c-organisation-logo)
  wrapper_classes << brand_helper.brand_class

  container_classes = [
    logo_helper.logo_container_class,
    brand_helper.border_color_class
  ]
  container_classes << "gem-c-organisation-logo__container--inline" if inline
%>
<<%= wrapping_element %>
  class="<%= wrapper_classes.join(" ") %>"
  <%= "data-module=gem-track-click" if organisation[:data_attributes] %>
>
  <% if organisation[:url] %>
    <%= link_to organisation[:url],
      class: container_classes.join(" "),
      data: organisation[:data_attributes] do %>
      <%= logo_helper.logo_content %>
    <% end %>
  <% else %>
    <div class="<%= container_classes.join(" ") %>">
      <%= logo_helper.logo_content %>
    </div>
  <% end %>
</<%= wrapping_element %>>

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
govuk_publishing_components-24.12.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.11.1 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.11.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.10.3 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.10.2 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.10.1 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.10.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.9.4 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.9.3 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.9.2 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.9.1 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.9.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.8.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.7.1 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.7.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.6.1 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.6.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.5.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.4.1 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-24.4.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb