Class: GovukPublishingComponents::Presenters::OrganisationLogoHelper
- Inherits:
-
Object
- Object
- GovukPublishingComponents::Presenters::OrganisationLogoHelper
- Includes:
- ActionView::Context, ActionView::Helpers
- Defined in:
- lib/govuk_publishing_components/presenters/organisation_logo_helper.rb
Instance Attribute Summary collapse
-
#crest ⇒ Object
readonly
Returns the value of attribute crest.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#logo_image_alt ⇒ Object
readonly
Returns the value of attribute logo_image_alt.
-
#logo_image_src ⇒ Object
readonly
Returns the value of attribute logo_image_src.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(local_assigns) ⇒ OrganisationLogoHelper
constructor
A new instance of OrganisationLogoHelper.
- #logo_container_class ⇒ Object
- #logo_content ⇒ Object
Constructor Details
#initialize(local_assigns) ⇒ OrganisationLogoHelper
Returns a new instance of OrganisationLogoHelper.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 9 def initialize(local_assigns) @name = local_assigns[:organisation][:name] @url = local_assigns[:organisation][:url] @crest = local_assigns[:organisation][:crest] @image = local_assigns[:organisation][:image] || false if @image @logo_image_src = local_assigns[:organisation][:image][:url] || false @logo_image_alt = local_assigns[:organisation][:image][:alt_text] || false end end |
Instance Attribute Details
#crest ⇒ Object (readonly)
Returns the value of attribute crest.
7 8 9 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 7 def crest @crest end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
7 8 9 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 7 def image @image end |
#logo_image_alt ⇒ Object (readonly)
Returns the value of attribute logo_image_alt.
7 8 9 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 7 def logo_image_alt @logo_image_alt end |
#logo_image_src ⇒ Object (readonly)
Returns the value of attribute logo_image_src.
7 8 9 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 7 def logo_image_src @logo_image_src end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 7 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 7 def url @url end |
Instance Method Details
#logo_container_class ⇒ Object
28 29 30 31 32 33 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 28 def logo_container_class logo_class = "gem-c-organisation-logo__container" logo_class = "#{logo_class} gem-c-organisation-logo__link" if url logo_class = "#{logo_class} gem-c-organisation-logo__crest gem-c-organisation-logo__crest--#{crest}" if crest logo_class end |
#logo_content ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/govuk_publishing_components/presenters/organisation_logo_helper.rb', line 20 def logo_content if image image_tag(logo_image_src, alt: logo_image_alt, class: "gem-c-organisation-logo__image") else content_tag("span", name, class: "gem-c-organisation-logo__name") end end |