Sha256: ad228174e3458b27d71b090483e892cb722951022ad833033ccd35727fcfc0e2

Contents?: true

Size: 884 Bytes

Versions: 9

Compression:

Stored size: 884 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(translated_attribute(model.settings.description))
      end

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

      def cta_button
        link_to translated_button_text, button_url, class: "button button--sc medium-6", title: translated_button_text
      end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-core-0.26.5 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.26.4 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.26.3 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.27.0.rc1 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.26.2 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.26.1 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.26.0 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.26.0.rc2 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.26.0.rc1 app/cells/decidim/content_blocks/cta_cell.rb