mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Allow users to confirm their proposal
This commit is contained in:
parent
3181c1c0d8
commit
a9207671b8
3 changed files with 26 additions and 2 deletions
|
|
@ -1,9 +1,12 @@
|
|||
class ProposalController < ApplicationController
|
||||
before_filter :verify_user
|
||||
before_filter :verify_access, :only => [:edit, :update, :destroy]
|
||||
before_filter :verify_access, :only => [:edit, :update, :destroy, :confirm]
|
||||
|
||||
def verify_access
|
||||
@person = current_user.person
|
||||
if params.has_key? :proposal_id
|
||||
params[:id] = params[:proposal_id]
|
||||
end
|
||||
begin
|
||||
if !organizer_or_admin?
|
||||
@event = @person.event.find(params[:id])
|
||||
|
|
@ -105,4 +108,24 @@ class ProposalController < ApplicationController
|
|||
def show
|
||||
|
||||
end
|
||||
|
||||
def confirm
|
||||
if @event.transition_possible? :confirm
|
||||
begin
|
||||
@event.confirm!
|
||||
rescue Exception => e
|
||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Event was NOT confirmed: #{e.message}')
|
||||
return
|
||||
end
|
||||
|
||||
if !@conference.user_registered?(current_user)
|
||||
redirect_to(register_conference_path(@conference.short_title), :notice => "Event was confirmed. Please register to attend the conference.")
|
||||
return
|
||||
end
|
||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :notice => 'Event was confirmed.')
|
||||
else
|
||||
redirect_to(conference_proposal_index_path(:conference_id => @conference.short_title), :alert => 'Event was NOT confirmed!')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue