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
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/decidim/api/proposal_type.rb', line 55 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
26 27 28 |
# File 'lib/decidim/api/proposal_type.rb', line 26 def coordinates [object.latitude, object.longitude] end |
#meeting ⇒ Object
44 45 46 |
# File 'lib/decidim/api/proposal_type.rb', line 44 def meeting object..first if object.official_meeting? end |
#vote_count ⇒ Object
50 51 52 53 |
# File 'lib/decidim/api/proposal_type.rb', line 50 def vote_count current_component = object.component object.proposal_votes_count unless current_component.current_settings.votes_hidden? end |