Sha256: e536f911e1d36fa9d6dfd0451955ceb2d63a9dc2c49f9384c415c99d0fccc657

Contents?: true

Size: 1.38 KB

Versions: 13

Compression:

Stored size: 1.38 KB

Contents

<%
  add_gem_component_stylesheet("organisation-logo")

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

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

  # Check if `heading_level` is an appropriate number:
  use_heading = [*1..6].include?(heading_level)

  # Set the wrapping element to be a heading or a `div`:
  wrapping_element = (use_heading ? "h#{heading_level}" : "div").to_sym
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
  component_helper.add_class("gem-c-organisation-logo")
  component_helper.add_class(brand_helper.brand_class)
  component_helper.add_class("gem-c-organisation-logo--inverse") if inverse

  container_classes = [
    logo_helper.logo_container_class,
    brand_helper.border_color_class
  ]
  container_classes << "gem-c-organisation-logo__container--inline" if inline
%>

<%= content_tag(wrapping_element, **component_helper.all_attributes) do %>
  <% if organisation[:url] %>
    <%= link_to organisation[:url], class: container_classes.join(" ") do %>
      <%= logo_helper.logo_content %>
    <% end %>
  <% else %>
    <div class="<%= container_classes.join(" ") %>">
      <%= logo_helper.logo_content %>
    </div>
  <% end %>
<% end %>

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
govuk_publishing_components-51.1.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-51.0.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-50.0.1 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-50.0.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-49.1.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-49.0.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-48.0.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-47.0.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-46.4.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-46.3.1 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-46.3.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-46.2.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb
govuk_publishing_components-46.1.0 app/views/govuk_publishing_components/components/_organisation_logo.html.erb