parent
d9d72eae07
commit
424bf19a91
1 changed files with 9 additions and 18 deletions
|
|
@ -169,8 +169,11 @@ module Admin
|
||||||
|
|
||||||
def update_state(id, transition, notice, mail = false)
|
def update_state(id, transition, notice, mail = false)
|
||||||
event = Event.find(id)
|
event = Event.find(id)
|
||||||
if mail
|
if mail && params[:send_mail].blank? && event &&
|
||||||
check_mail_settings(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
|
end
|
||||||
if event
|
if event
|
||||||
begin
|
begin
|
||||||
|
|
@ -182,25 +185,13 @@ module Admin
|
||||||
end
|
end
|
||||||
event.save
|
event.save
|
||||||
rescue Transitions::InvalidTransition => e
|
rescue Transitions::InvalidTransition => e
|
||||||
redirect_to(
|
notice = "Update state failed. #{e.message}"
|
||||||
admin_conference_events_path(conference_id: @conference.short_title),
|
|
||||||
notice: "Update state failed. #{e.message}") && return
|
|
||||||
end
|
end
|
||||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
|
||||||
notice: notice)
|
|
||||||
else
|
else
|
||||||
|
notice = 'Error! Could not find event!'
|
||||||
|
end
|
||||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||||
notice: 'Error! Could not find event!')
|
notice: notice) && return
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_mail_settings(event)
|
|
||||||
if !params[:send_mail].blank? && event &&
|
|
||||||
event.conference.email_settings.rejected_email_template.nil? &&
|
|
||||||
event.conference.email_settings.accepted_email_template.nil?
|
|
||||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
|
||||||
notice: 'Update Email Template before Sending Mails') && return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue