Sha256: 60e7f7efc346b13b729baeb11c132eaafceb804e3c8c0eb352b82abd75ac2dcd

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    # This cell renders a collection of linked Participatory Space of current conference.
    # `model` is the current conference
    class LinkedParticipatorySpacesCell < Decidim::ViewModel
      include Decidim::ApplicationHelper
      include Decidim::CardHelper

      def show
        render
      end

      private

      def conference_spaces
        [conference_participatory_processes, conference_assemblies].compact
      end

      def conference_participatory_processes
        return unless Decidim.participatory_space_manifests.map(&:name).include?(:participatory_processes)

        processes = model.linked_participatory_space_resources(:participatory_processes, "included_participatory_processes")
        return unless processes.any?

        processes
      end

      def conference_assemblies
        return unless Decidim.participatory_space_manifests.map(&:name).include?(:assemblies)

        assemblies = model.linked_participatory_space_resources(:assemblies, "included_assemblies")
        return unless assemblies.any?

        assemblies
      end

      def title(block_space)
        block_space.first.class.name.demodulize.tableize
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-conferences-0.28.4 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.28.3 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.28.2 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.28.1 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.28.0 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.28.0.rc5 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.28.0.rc4 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb