Sha256: e7130f123011501b6aea2c85136f524ce70866a3ee37c929206c51d87717c1de

Contents?: true

Size: 989 Bytes

Versions: 72

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

72 entries across 72 versions & 1 rubygems

Version Path
govuk_publishing_components-21.42.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.41.4 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.41.3 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.41.2 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.41.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.41.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.40.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.39.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.38.5 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.38.4 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.38.3 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.38.2 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.38.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.38.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.37.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.36.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.36.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.35.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.34.1 lib/govuk_publishing_components/presenters/translation_nav_helper.rb
govuk_publishing_components-21.34.0 lib/govuk_publishing_components/presenters/translation_nav_helper.rb