Sha256: fffc3d6a4b54bfbd1c756cc0b5168e898037dbdcf64aea16cd4356bfbcb58134

Contents?: true

Size: 877 Bytes

Versions: 7

Compression:

Stored size: 877 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(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

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.25.2 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.25.1 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.25.0 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.25.0.rc4 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.25.0.rc3 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.25.0.rc2 app/cells/decidim/content_blocks/cta_cell.rb
decidim-core-0.25.0.rc1 app/cells/decidim/content_blocks/cta_cell.rb