Class: Decidim::Proposals::ProposalSearch
- Inherits:
-
ResourceSearch
- Object
- ResourceSearch
- Decidim::Proposals::ProposalSearch
- Defined in:
- app/services/decidim/proposals/proposal_search.rb
Overview
This service scopes the proposal searches with parameters that cannot be passed from the user interface.
Instance Attribute Summary collapse
-
#activity ⇒ Object
readonly
Returns the value of attribute activity.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#activity ⇒ Object (readonly)
Returns the value of attribute activity.
8 9 10 |
# File 'app/services/decidim/proposals/proposal_search.rb', line 8 def activity @activity end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'app/services/decidim/proposals/proposal_search.rb', line 8 def type @type end |
Instance Method Details
#build(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/services/decidim/proposals/proposal_search.rb', line 10 def build(params) return super if search_context == :admin @type = params[:type] @activity = params[:activity] if params[:activity] && user case params[:activity] when "voted" add_scope(:voted_by, user) when "my_proposals" add_scope(:coauthored_by, user) end end add_scope(:with_type, [params[:type], user, component]) if params[:type] super end |