Class: GovukPublishingComponents::Presenters::TranslationNavHelper
- Inherits:
-
Object
- Object
- GovukPublishingComponents::Presenters::TranslationNavHelper
- Defined in:
- lib/govuk_publishing_components/presenters/translation_nav_helper.rb
Instance Attribute Summary collapse
-
#translations ⇒ Object
readonly
Returns the value of attribute translations.
Instance Method Summary collapse
- #classes ⇒ Object
- #has_translations? ⇒ Boolean
-
#initialize(local_assigns) ⇒ TranslationNavHelper
constructor
A new instance of TranslationNavHelper.
- #inverse_class ⇒ Object
- #margin_class ⇒ Object
Constructor Details
#initialize(local_assigns) ⇒ TranslationNavHelper
Returns a new instance of TranslationNavHelper.
6 7 8 9 10 11 |
# 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 |
Instance Attribute Details
#translations ⇒ Object (readonly)
Returns the value of attribute translations.
4 5 6 |
# File 'lib/govuk_publishing_components/presenters/translation_nav_helper.rb', line 4 def translations @translations end |
Instance Method Details
#classes ⇒ Object
17 18 19 20 21 22 |
# File 'lib/govuk_publishing_components/presenters/translation_nav_helper.rb', line 17 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? ⇒ Boolean
13 14 15 |
# File 'lib/govuk_publishing_components/presenters/translation_nav_helper.rb', line 13 def has_translations? true if @translations.length > 1 end |
#inverse_class ⇒ Object
24 25 26 |
# File 'lib/govuk_publishing_components/presenters/translation_nav_helper.rb', line 24 def inverse_class "gem-c-translation-nav--inverse" end |
#margin_class ⇒ Object
28 29 30 |
# File 'lib/govuk_publishing_components/presenters/translation_nav_helper.rb', line 28 def margin_class "gem-c-translation-nav--no-margin-top" end |