mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44: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
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
%td
|
||||
.pull-right
|
||||
- if event.transition_possible? :confirm
|
||||
= link_to "Confirm", "#", :class => "btn btn-mini btn-success"
|
||||
= link_to "Confirm", conference_proposal_confirm_path(@conference.short_title, event), :method => :put, :class => "btn btn-mini btn-success"
|
||||
- if @conference.cfp_open?
|
||||
- if !event.unconfirmed? && !event.confirmed?
|
||||
= link_to "Edit", edit_conference_proposal_path(@conference.short_title, event.id), :class => "btn btn-mini btn-primary"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ Osem::Application.routes.draw do
|
|||
resources :conference, :only => [] do
|
||||
resources :proposal do
|
||||
resources :event_attachment, :controller => "EventAttachments"
|
||||
put "/confirm" => "proposal#confirm"
|
||||
end
|
||||
member do
|
||||
get "/register" => "ConferenceRegistration#register"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue