Sha256: e26f4f274ac1834533e54ffca9d6550abf785cac5da5f1d388a54ce2acb22b66

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Decidim
  module Slider
    module Tabs
      module Generic
        class MainCell < Decidim::ViewModel
          def index
            context[:index]
          end

          def content
            translated_attribute(model.settings.content)
          end

          def title
            translated_attribute(model.settings.title)
          end

          def accessibility_label
            translated_attribute(model.settings.accessibility_label)
          end

          def valid_link?
            url.present? && cta.present?
          end

          def url
            translated_attribute(model.settings.url)
          end

          def cta
            translated_attribute(model.settings.cta)
          end

          def secondary_link?
            secondary_url.present? && secondary_cta.present?
          end

          def secondary_url
            translated_attribute(model.settings.secondary_url)
          end

          def secondary_cta
            translated_attribute(model.settings.secondary_cta)
          end

          def cache_hash
            hash = []
            hash.push(I18n.locale)
            hash.push(model.cache_key_with_version)
            hash.join(Decidim.cache_key_separator)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-slider-0.0.1 app/cells/decidim/slider/tabs/generic/main_cell.rb