parent
2343db254d
commit
3f45416d48
8 changed files with 163 additions and 36 deletions
|
|
@ -168,13 +168,7 @@ module Admin
|
|||
private
|
||||
|
||||
def update_state(id, transition, notice, mail = false)
|
||||
event = Event.find(id)
|
||||
if mail && params[:send_mail].blank? && event &&
|
||||
(event.conference.email_settings.rejected_email_template.nil? ||
|
||||
event.conference.email_settings.accepted_email_template.nil?)
|
||||
return redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||
notice: 'Update Email Template before Sending Mails') && return
|
||||
end
|
||||
event = Event.find_by_id(id)
|
||||
if event
|
||||
begin
|
||||
if mail
|
||||
|
|
@ -185,13 +179,18 @@ module Admin
|
|||
end
|
||||
event.save
|
||||
rescue Transitions::InvalidTransition => e
|
||||
notice = "Update state failed. #{e.message}"
|
||||
error = "Update state failed. #{e.message}"
|
||||
end
|
||||
else
|
||||
notice = 'Error! Could not find event!'
|
||||
error = 'Error! Could not find event!'
|
||||
end
|
||||
if error
|
||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||
alert: error) && return
|
||||
else
|
||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||
notice: notice) && return
|
||||
end
|
||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||
notice: notice) && return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue