Sha256: 690a600841c0909ad180419dac712cbbe760bf87c80b7f0d96083d3f34ad52cf

Contents?: true

Size: 666 Bytes

Versions: 16

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ContentBlocks
    class SubHeroCell < Decidim::ViewModel
      include Decidim::IconHelper
      include Decidim::SanitizeHelper

      def show
        return if translated_attribute(current_organization.description).blank?

        render
      end

      private

      def organization_description
        desc = decidim_sanitize(translated_attribute(current_organization.description))

        # Strip the surrounding paragraph tag because it is not allowed within
        # a <hN> element.
        desc.gsub(%r{</p>\s+<p>}, "<br><br>").gsub(%r{<p>(((?!</p>).)*)</p>}mi, "\\1")
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
decidim-core-0.26.5 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.4 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.3 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.0.rc1 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.2 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.1 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.0 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.0.rc2 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.0.rc1 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.25.2 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.25.1 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.25.0 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.25.0.rc4 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.25.0.rc3 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.25.0.rc2 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.25.0.rc1 app/cells/decidim/content_blocks/sub_hero_cell.rb