Sha256: cb3bf7ca3fe9b3b0bd51f0d072f1d73af535ea1ebdc113946fa6c34e76a91dda

Contents?: true

Size: 758 Bytes

Versions: 13

Compression:

Stored size: 758 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    module ContentBlocks
      class RelatedAssembliesCell < Decidim::ContentBlocks::BaseCell
        def show
          render if total_count.positive?
        end

        def related_assemblies
          @related_assemblies ||=
            resource
            .linked_participatory_space_resources(:assembly, "included_participatory_processes")
            .public_spaces
        end

        def total_count
          related_assemblies.size
        end

        private

        def title
          t("name", scope: "decidim.assemblies.content_blocks.related_assemblies")
        end

        def limit
          model.settings.try(:max_results)
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-assemblies-0.29.1 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.28.4 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.29.0 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.28.3 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.29.0.rc4 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.29.0.rc3 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.29.0.rc2 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.29.0.rc1 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.28.2 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.28.1 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.28.0 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.28.0.rc5 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb
decidim-assemblies-0.28.0.rc4 app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb