Changesets can be listed by changeset number.
The Git repository is here.
Changeset 457
Add admin ability to revert an underway poll to an open state.
More sensible entries now presented in the state change menu.
- Comitted by: rool
- Date: Thursday October 24 05:58:50 2013 (over 11 years ago)
Affected files:
- rool/rails/canvass/trunk/app/helpers/application_helper.rb (diff)
- rool/rails/canvass/trunk/app/helpers/polls_helper.rb (diff)
- rool/rails/canvass/trunk/app/models/poll.rb (diff)
- rool/rails/canvass/trunk/config/environment.rb (diff)
- rool/rails/canvass/trunk/config/locales/en.yml (diff)
rool/rails/canvass/trunk/app/helpers/application_helper.rb:
prev. | current | |
apphelp_view_hint( "state_#{ state }", ctrl ) | ||
end | ||
208 | # As "apphelp_state", but works with event names. | |
209 | # | |
210 | def apphelp_event( event, ctrl = controller ) | |
211 | apphelp_view_hint( "event_#{ event }", ctrl ) | |
212 | end | |
213 | ||
# Constructs links to controllers and actions based on whether or not users | ||
# can perform given actions. | ||
# |
rool/rails/canvass/trunk/app/helpers/polls_helper.rb:
prev. | current | |
'' | ||
] | ||
69 | # 'Events' is a hash of event names yielding event data. Collect this to | |
70 | # an array of key/value pairs and sort using the value's "transitions_to" | |
71 | # field. State names have "a_", "b_" etc. prefixes so that they sort in a | |
72 | # rational order for the progression from one state to another. | |
73 | ||
74 | events = item.current_state.events.dup.collect.sort do | a, b | | |
75 | a[ 1 ].transitions_to.to_s <=> b[ 1 ].transitions_to.to_s | |
76 | end | |
77 | ||
78 | # Generate a menu from this array using the translated event name for the | |
79 | # visible text and the state name to which the item should be transitioned | |
80 | # as the associated form value. We use the sorted array from above rather | |
81 | # than the raw events data as the raw events hash is not sorted by logical | |
82 | # transition order (hashes are not inherently sorted and event names do | |
83 | # not have the sortable prefix convention used for state names). | |
84 | ||
form.select( | ||
:workflow_state, | ||
71 | | |
72 | | |
87 | events.collect { | event | | |
88 | event_name = event[ 0 ] | |
89 | event_data = event[ 1 ] | |
90 | [ apphelp_event( event_name, PollsController ), event_data.transitions_to ] | |
}.unshift( blank_entry ), | ||
:selected => '' | ||
) | ||
76 | | |
94 | end | |
end |
rool/rails/canvass/trunk/app/models/poll.rb:
prev. | current | |
# the developer be taking "too long" to complete the work. That's up to | ||
# individual administrators or organisations to assess. | ||
# | ||
182 | # Administrators may choose to revert a poll, if it turns out it was | |
183 | # not really being developed or a developer halts work. The poll is | |
184 | # still wanted, so not expired; it returns to an OPEN state. No money | |
185 | # is redistributed. | |
186 | # | |
# Organisations may choose to pay developers before or after they | ||
# complete work. The general recommendation is to do so only when the | ||
# poll reaches a STATE_COMPLETED state, but again, individual | ||
... | ... | |
state STATE_UNDERWAY do | ||
event :completed, :transitions_to => STATE_COMPLETED | ||
event :expired, :transitions_to => STATE_EXPIRED | ||
195 | event :reverted, :transitions_to => STATE_OPEN | |
end | ||
# STATE_COMPLETED: Work on the poll completed; the associated feature is |
rool/rails/canvass/trunk/config/environment.rb:
prev. | current | |
# Be sure to restart your server when you modify this file | ||
# Specifies gem version of Rails to use when vendor/rails is not present | ||
4 | ||
4 | RAILS_GEM_VERSION = '2.3.18' unless defined? RAILS_GEM_VERSION | |
# Bootstrap the Rails environment, frameworks, and default configuration | ||
require File.join(File.dirname(__FILE__), 'boot') |
rool/rails/canvass/trunk/config/locales/en.yml:
prev. | current | |
org: | ||
pond: | ||
canvass: | ||
99 | | |
99 | site_name: "RISC OS Open" | |
site_tagline: "...your opinion" | ||
action_names: | ||
... | ... | |
view_state_c_completed: "Completed" | ||
view_state_d_expired: "Expired" | ||
330 | view_event_underway: "Get underway" | |
331 | view_event_expired: "Expire" | |
332 | view_event_completed: "Complete" | |
333 | view_event_reverted: "Revert to open" | |
334 | ||
view_menu_no_change: "No change" | ||
view_state_change_care_hint: "Take care! State changes cannot be undone." | ||
view_cannot_change_currency_hint: "Currency cannot change after the bounty has attracted donations." | ||
... | ... | |
view_no_index_items: "No matching bounties can be found." | ||
view_list_of_donations: "Donations" | ||
344 | view_matching_pot: "%{amount} left for matching" | |
view_preview: "Preview" | ||
view_preview_no_js: "The preview will only work if your browser has robust support for JavaScript enabled." |