19 lines
537 B
Ruby
19 lines
537 B
Ruby
# Contact page form
|
|
class ContactFormsController < ApplicationController
|
|
def create
|
|
@contact_form = Cmtool::ContactForm.new(contact_form_params)
|
|
if @contact_form.save
|
|
Notifier.contact_form(@contact_form.id).deliver_later
|
|
redirect_to root_path, notice: t('website.contact_form.submitted')
|
|
else
|
|
redirect_to page_path('contact', locale: I18n.locale), alert: @contact_form.errors.full_messages.join(', ')
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def contact_form_params
|
|
params.require(:contact_form).permit!
|
|
end
|
|
end
|