Sha256: 44cf528dff5b4612b6428a24d643c40912aaba16f6ab181a8deeaa0635ab262a

Contents?: true

Size: 869 Bytes

Versions: 10

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ContentBlocks
    class ParticipatorySpaceMetadataCell < BaseCell
      def show
        return if metadata_valued_items.blank?

        render
      end

      def metadata_valued_items
        metadata_items.filter_map do |item|
          next if (value = decidim_escape_translated(presented_space.send(item))).blank?

          {
            title: t(item, scope: translations_scope),
            value:
          }
        end
      end

      private

      def metadata_items = []

      def presented_space
        space_presenter.new(resource)
      end

      def space_presenter
        raise "#{self.class.name} is expected to implement #space_presenter"
      end

      def translations_scope
        raise "#{self.class.name} is expected to implement #translations_scope"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.28.4 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.29.0 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.28.3 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.29.0.rc4 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.29.0.rc3 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.29.0.rc2 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.29.0.rc1 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.28.2 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb
decidim-core-0.28.1 app/cells/decidim/content_blocks/participatory_space_metadata_cell.rb