Class: Decidim::Proposals::ProposalType
- Inherits:
-
Api::Types::BaseObject
- Object
- Api::Types::BaseObject
- Decidim::Proposals::ProposalType
- Defined in:
- lib/decidim/api/proposal_type.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.authorized?(object, context) ⇒ Boolean
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/decidim/api/proposal_type.rb', line 51 def self.(object, context) context[:proposal] = object chain = [ allowed_to?(:read, :proposal, object, context), object.published? ].all? super && chain rescue Decidim::PermissionAction::PermissionNotSetError false end |
Instance Method Details
#coordinates ⇒ Object
38 39 40 |
# File 'lib/decidim/api/proposal_type.rb', line 38 def coordinates [object.latitude, object.longitude] end |
#meeting ⇒ Object
42 43 44 |
# File 'lib/decidim/api/proposal_type.rb', line 42 def meeting object..first if object.official_meeting? end |
#vote_count ⇒ Object
46 47 48 49 |
# File 'lib/decidim/api/proposal_type.rb', line 46 def vote_count current_component = object.component object.proposal_votes_count unless current_component.current_settings.votes_hidden? end |