Sha256: 455f2dad8e18ad3a4c314de1892af696996a92f29eecb6385b0952971bbdf267

Contents?: true

Size: 1.33 KB

Versions: 44

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

require "cell/partial"

module Decidim
  module NewsletterTemplates
    class ImageTextCtaCell < BaseCell
      def show
        render :show
      end

      def introduction
        parse_interpolations(uninterpolated_introduction, recipient_user, newsletter.id)
      end

      def uninterpolated_introduction
        translated_attribute(model.settings.introduction)
      end

      def body
        parse_interpolations(uninterpolated_body, recipient_user, newsletter.id)
      end

      def uninterpolated_body
        translated_attribute(model.settings.body)
      end

      def has_cta?
        cta_text.present? && cta_url.present?
      end

      def cta_text
        parse_interpolations(
          translated_attribute(model.settings.cta_text),
          recipient_user,
          newsletter.id
        )
      end

      def cta_url
        translated_attribute(model.settings.cta_url)
      end

      def has_main_image?
        newsletter.template.images_container.main_image.attached?
      end

      def main_image
        image_tag main_image_url
      end

      def main_image_url
        newsletter.template.images_container.attached_uploader(:main_image).url(host: organization.host)
      end

      def organization_primary_color
        organization.colors["primary"]
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.28.4 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.27.9 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.29.0 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.28.3 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.27.8 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.29.0.rc4 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.29.0.rc3 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.29.0.rc2 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.29.0.rc1 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.28.2 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.27.7 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.28.1 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.27.6 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.26.10 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.26.9 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.28.0 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.27.5 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.28.0.rc5 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb
decidim-core-0.28.0.rc4 app/cells/decidim/newsletter_templates/image_text_cta_cell.rb