Sha256: bbc094701ca84d60e8ed6d879c7253915959e548bcfd56430f0b0f4f3c72b317

Contents?: true

Size: 672 Bytes

Versions: 22

Compression:

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

22 entries across 22 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.9 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.28.3 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.8 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.28.2 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.7 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.28.1 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.6 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.10 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.9 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.28.0 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.5 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.28.0.rc5 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.28.0.rc4 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.8 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.4 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.3 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.26.7 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.2 app/cells/decidim/content_blocks/sub_hero_cell.rb
decidim-core-0.27.1 app/cells/decidim/content_blocks/sub_hero_cell.rb