Improvements in proposal controller
`if..else` is better than unless with return. On failed update render `edit` template and not render `new` template. On failed save redirect to index path and not render `new` template. Change `destory` to `withdraw`, cause `destroy` makes DELETE request when we are updating the event record. Check for success for save in withdraw (save can fail for reasons other than validation).
This commit is contained in:
parent
10ef898a0d
commit
dcb98c49f9
3 changed files with 36 additions and 34 deletions
|
|
@ -87,7 +87,7 @@
|
|||
method: :patch, class: 'btn btn-mini btn-success', id: "confirm_proposal_#{event.id}"
|
||||
|
||||
- if event.transition_possible? :withdraw
|
||||
= link_to 'Withdraw', conference_program_proposal_path(@conference.short_title, event.id), method: :delete,
|
||||
= link_to 'Withdraw', withdraw_conference_program_proposal_path(@conference.short_title, event.id), method: :patch,
|
||||
data: { confirm: 'Are you sure you want to withdraw this proposal?' }, class: 'btn btn-mini btn-warning',
|
||||
id: "delete_proposal_#{event.id}"
|
||||
- if event.state == 'withdrawn' || event.state == 'rejected'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue