Sha256: 76444e41d277f8d5a85517bb8f012fd21809e61b7f35c3e7a3b6cca2975eba9c

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 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::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

6 entries across 6 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.29.0 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.29.0.rc4 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.29.0.rc3 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.29.0.rc2 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb
decidim-conferences-0.29.0.rc1 app/cells/decidim/conferences/linked_participatory_spaces_cell.rb