Sha256: 52218a890d890397c1eee20405294faaa80781132c4fb3bf6b4e055d630c006e

Contents?: true

Size: 989 Bytes

Versions: 350

Compression:

Stored size: 989 Bytes

Contents

module GovukPublishingComponents
  module Presenters
    class TranslationNavHelper
      attr_reader :translations

      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

      def has_translations?
        true if @translations.length > 1
      end

      def tracking_is_present?
        @translations.each do |translation|
          return true if translation[:data_attributes]
        end
        false
      end

      def classes
        classes = %w[gem-c-translation-nav]
        classes << inverse_class if @inverse
        classes << margin_class if @no_margin_top
        classes.join(" ")
      end

      def inverse_class
        "gem-c-translation-nav--inverse"
      end

      def margin_class
        "gem-c-translation-nav--no-margin-top"
      end
    end
  end
end

Version data entries

350 entries across 350 versions & 1 rubygems

Version Path
govuk_publishing_components-40.1.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-40.0.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-39.2.5 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-39.2.4 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-39.2.3 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-39.2.2 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-39.2.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-39.2.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-39.1.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-39.0.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-38.4.2 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-38.1.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-38.1.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-38.0.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-38.0.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-37.10.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-37.9.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-37.9.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-37.8.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-37.8.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb