Sha256: 6acb286655165a7937700e9198c5829757e02e7609a26de207459d5bb6e0531c
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true module Decidim module ContentBlocks class ParticipatorySpaceHeroCell < Decidim::ContentBlocks::BaseCell include Decidim::SanitizeHelper include Decidim::TranslationsHelper include Decidim::TwitterSearchHelper delegate :title, :hashtag, :attached_uploader, to: :resource def cta_text return unless model @cta_text ||= translated_attribute(model.settings.button_text).presence end def cta_path return unless model @cta_path ||= translated_attribute(model.settings.button_url).presence end def title_text decidim_escape_translated(title) end def subtitle_text return unless resource.respond_to?(:subtitle) decidim_escape_translated(resource.subtitle) end # If it is called from the landing page content block, use the background image defined there # Else, use the banner image defined in the space (for assemblies) def image_path return model.images_container.attached_uploader(:background_image).path if model.respond_to?(:images_container) attached_uploader(:banner_image).path end def has_hashtag? @has_hashtag ||= hashtag.present? end def has_cta? [cta_text, cta_path].all? end def escaped_hashtag return unless has_hashtag? @escaped_hashtag ||= decidim_html_escape(hashtag) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.28.2 | app/cells/decidim/content_blocks/participatory_space_hero_cell.rb |
decidim-core-0.28.1 | app/cells/decidim/content_blocks/participatory_space_hero_cell.rb |