Add contact form notification

This commit is contained in:
2015-02-26 05:22:36 +01:00
parent 4283f0313b
commit 9e9a732384
5 changed files with 53 additions and 0 deletions
@@ -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(', ')
+10
View File
@@ -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
+10
View File
@@ -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