Class: Decidim::Budgets::Workflows::One
- Inherits:
-
Base
- Object
- Base
- Decidim::Budgets::Workflows::One
- Defined in:
- decidim-budgets/lib/decidim/budgets/workflows/one.rb
Overview
This Workflow allows users to vote in any budget, but only in one.
Instance Method Summary collapse
-
#discardable ⇒ Object
Public: Returns a list of budgets where the user can discard their order to vote in another.
-
#highlighted?(_resource) ⇒ Boolean
No budget resource is highlighted for this workflow.
-
#vote_allowed?(resource, consider_progress: true) ⇒ Boolean
Users can vote in any budget with this workflow, but only in one.
Instance Method Details
#discardable ⇒ Object
Public: Returns a list of budgets where the user can discard their order to vote in another.
Returns Array.
27 28 29 |
# File 'decidim-budgets/lib/decidim/budgets/workflows/one.rb', line 27 def discardable progress + voted end |
#highlighted?(_resource) ⇒ Boolean
No budget resource is highlighted for this workflow.
9 10 11 |
# File 'decidim-budgets/lib/decidim/budgets/workflows/one.rb', line 9 def highlighted?(_resource) false end |
#vote_allowed?(resource, consider_progress: true) ⇒ Boolean
Users can vote in any budget with this workflow, but only in one.
14 15 16 17 18 19 20 21 22 |
# File 'decidim-budgets/lib/decidim/budgets/workflows/one.rb', line 14 def vote_allowed?(resource, consider_progress: true) return false if voted.any? if consider_progress progress?(resource) || progress.none? else true end end |