Sha256: 4d4e06704b3430e20b3df78520b1eef364ea5adc2ba1534599eaa276d78716dd

Contents?: true

Size: 739 Bytes

Versions: 7

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ContentBlocks
    class CtaCell < Decidim::ViewModel
      include Decidim::SanitizeHelper

      def show
        return if button_url.blank?

        render
      end

      def translated_button_text
        @translated_button_text ||= translated_attribute(model.settings.button_text)
      end

      def translated_description
        @translated_description ||= decidim_sanitize_editor_admin(translated_attribute(model.settings.description))
      end

      def button_url
        @button_url ||= model.settings.button_url
      end

      def background_image
        model.images_container.attached_uploader(:background_image).path(variant: :big)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.28.3 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.28.2 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.28.1 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.28.0 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.28.0.rc5 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.28.0.rc4 app/cells/decidim/content_blocks/cta_cell.rb