Add contact form notification
This commit is contained in:
@@ -2,6 +2,7 @@ class ContactFormsController < ApplicationController
|
||||
def create
|
||||
@contact_form = Cmtool::ContactForm.new(contact_form_params)
|
||||
if @contact_form.save
|
||||
Notifier.contact_form(@contact_form.id).deliver
|
||||
redirect_to root_path, notice: t('contact_form.submitted')
|
||||
else
|
||||
redirect_to go_to_path('contact', locale: I18n.locale), alert: @contact_form.errors.full_messages.join(', ')
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
class Notifier < ActionMailer::Base
|
||||
default from: "Qwaiter <service@mozo.bar>"
|
||||
layout 'mail'
|
||||
|
||||
def contact_form(contact_form_id)
|
||||
@contact_form = Cmtool::ContactForm.find(contact_form_id)
|
||||
I18n.locale = :en
|
||||
mail to: "contact-form@mozo.bar", subject: "[CONTACTFORM] new entry"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
h2 New contact form entry
|
||||
dl
|
||||
dt Name
|
||||
dd= @contact_form.name
|
||||
dt Gender
|
||||
dd= @contact_form.gender
|
||||
dt E-mail
|
||||
dd= @contact_form.email
|
||||
|
||||
pre= @contact_form.body
|
||||
Reference in New Issue
Block a user