class GovukPublishingComponents::Presenters::TranslationNavHelper

Attributes

translations[R]

Public Class Methods

new(local_assigns) click to toggle source
# File lib/govuk_publishing_components/presenters/translation_nav_helper.rb, line 6
def initialize(local_assigns)
  @translations = []
  @translations = local_assigns[:translations] if local_assigns[:translations]
  @no_margin_top = local_assigns[:no_margin_top]
  @inverse = local_assigns[:inverse]
end

Public Instance Methods

classes() click to toggle source
# File lib/govuk_publishing_components/presenters/translation_nav_helper.rb, line 24
def classes
  classes = %w[gem-c-translation-nav]
  classes << inverse_class if @inverse
  classes << margin_class if @no_margin_top
  classes.join(" ")
end
has_translations?() click to toggle source
# File lib/govuk_publishing_components/presenters/translation_nav_helper.rb, line 13
def has_translations?
  true if @translations.length > 1
end
inverse_class() click to toggle source
# File lib/govuk_publishing_components/presenters/translation_nav_helper.rb, line 31
def inverse_class
  "gem-c-translation-nav--inverse"
end
margin_class() click to toggle source
# File lib/govuk_publishing_components/presenters/translation_nav_helper.rb, line 35
def margin_class
  "gem-c-translation-nav--no-margin-top"
end
tracking_is_present?() click to toggle source
# File lib/govuk_publishing_components/presenters/translation_nav_helper.rb, line 17
def tracking_is_present?
  @translations.each do |translation|
    return true if translation[:data_attributes]
  end
  false
end