Allow editing candidates
This commit is contained in:
parent
62e70e3935
commit
a5a9e92e18
3 changed files with 40 additions and 0 deletions
24
vedia.rb
24
vedia.rb
|
|
@ -333,6 +333,30 @@ post '/votes/:id/candidates' do
|
|||
redirect '/votes/' + @vote.secure_id
|
||||
end
|
||||
|
||||
get '/votes/:id/candidates/:cid' do
|
||||
require_login
|
||||
find_vote
|
||||
require_organizer
|
||||
require_draft_vote
|
||||
find_candidate
|
||||
require_candidate_in_vote
|
||||
erb :candidates_edit
|
||||
end
|
||||
|
||||
post '/votes/:id/candidates/:cid' do
|
||||
require_login
|
||||
find_vote
|
||||
require_organizer
|
||||
require_draft_vote
|
||||
find_candidate
|
||||
require_candidate_in_vote
|
||||
@candidate.name = params[:name]
|
||||
@candidate.description = params[:description]
|
||||
@candidate.save
|
||||
redirect '/votes/' + @vote.secure_id
|
||||
erb :candidates_edit
|
||||
end
|
||||
|
||||
post '/votes/:id/candidates/:cid/delete' do
|
||||
require_login
|
||||
find_vote
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue