Add emails for booth's acceptance and rejection

This commit is contained in:
nasia 2017-08-02 20:10:47 +03:00 committed by Stella Rouzi
parent 5f9c0065c6
commit 7107f9a35f
11 changed files with 114 additions and 10 deletions

View file

@ -47,7 +47,18 @@ module Admin
end
def accept
update_state(:accept, 'Booth accepted!')
@booth.accept!
if @booth.save
if @conference.email_settings.send_on_booths_acceptance
Mailbot.conference_booths_acceptance_mail(@booth).deliver
end
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
notice: 'Booth successfully accepted!'
else
redirect_to admin_conference_booths_path(conference_id: @conference.short_title)
flash[:error] = "Booth could not be accepted. #{@booth.errors.full_messages.to_sentence}."
end
end
def to_accept
@ -59,7 +70,16 @@ module Admin
end
def reject
update_state(:reject, 'Booth rejected')
@booth.reject!
if @booth.save
Mailbot.conference_booths_rejection_mail(@booth).deliver
redirect_to admin_conference_booths_path(conference_id: @conference.short_title),
notice: 'Booth successfully rejected.'
else
redirect_to admin_conference_booths_path(conference_id: @conference.short_title)
flash[:error] = "Booth could not be rejected. #{@booth.errors.full_messages.to_sentence}."
end
end
def restart