Class: Decidim::Sortitions::Admin::ParticipatorySpaceProposalComponents

Inherits:
Rectify::Query
  • Object
show all
Defined in:
decidim-sortitions/app/queries/decidim/sortitions/admin/participatory_space_proposal_components.rb

Overview

Query that retrieves a list of proposal components

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(participatory_space) ⇒ ParticipatorySpaceProposalComponents

Initializes the query


17
18
19
# File 'decidim-sortitions/app/queries/decidim/sortitions/admin/participatory_space_proposal_components.rb', line 17

def initialize(participatory_space)
  @participatory_space = participatory_space
end

Instance Attribute Details

#participatory_spaceObject (readonly)

Returns the value of attribute participatory_space


8
9
10
# File 'decidim-sortitions/app/queries/decidim/sortitions/admin/participatory_space_proposal_components.rb', line 8

def participatory_space
  @participatory_space
end

Class Method Details

.for(participatory_space) ⇒ Object

Sugar syntax. Allow retrieving all proposal components for the given participatory space.


12
13
14
# File 'decidim-sortitions/app/queries/decidim/sortitions/admin/participatory_space_proposal_components.rb', line 12

def self.for(participatory_space)
  new(participatory_space).query
end

Instance Method Details

#queryObject


21
22
23
24
25
# File 'decidim-sortitions/app/queries/decidim/sortitions/admin/participatory_space_proposal_components.rb', line 21

def query
  Component
    .where(participatory_space: participatory_space, manifest_name: "proposals")
    .published
end