Sha256: 2bbf156adb19ca4a2a9d594400132da13c439710adfa40a69adb244f77159af3

Contents?: true

Size: 1.05 KB

Versions: 50

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This interface represents a participatorySpaceResourceable object.
    # It create and array of linked participatory spaces for each registered manifest

    module ParticipatorySpaceResourceableInterface
      include Decidim::Api::Types::BaseInterface

      # name "ParticipatorySpaceResourcableInterface"
      description "An interface that can be used in objects with participatorySpaceResourceable"

      # this handles the cases linked_participatory_space_resources(:participatory_space, :included_participatory_space)
      field :linked_participatory_spaces, [ParticipatorySpaceLinkType],
            null: false,
            description: "Lists all linked participatory spaces in a polymorphic way"

      def linked_participatory_spaces
        Decidim::ParticipatorySpaceLink.where("name like 'included_%' and ((from_id=:id and from_type=:type) or (to_id=:id and to_type=:type))",
                                              id: object.id, type: object.class.name)
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
decidim-core-0.29.1 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.28.4 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.27.9 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.29.0 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.28.3 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.27.8 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.29.0.rc4 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.29.0.rc3 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.29.0.rc2 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.29.0.rc1 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.28.2 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.27.7 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.28.1 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.27.6 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.26.10 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.26.9 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.28.0 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.27.5 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.28.0.rc5 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb
decidim-core-0.28.0.rc4 lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb