formulaire contact

This commit is contained in:
Nicolas Bally 2013-07-25 18:38:38 +02:00
parent 8b2a8c139d
commit 1cedbaed2f
7 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,10 @@
class Public::ContactController < ApplicationController
layout "public"
def new
end
def create
@params = params
DemandeMail.prise(@params).deliver
end
end

View File

@ -0,0 +1,10 @@
class DemandeMail < ActionMailer::Base
default from: "info@nicolasbally.com"
def prise(params)
@params = params
mail to: "n.bally@quartz-agence.com", :bcc => "info@nicolasbally.com", :subject => "Demande de contact par le site."
end
end

View File

@ -0,0 +1,8 @@
%p
Email :
=@params[:mail]
%p
Sujet :
=@params[:subject]
%hr
=simple_format @params[:message]

View File

@ -0,0 +1,2 @@
%h2 Merci beaucoup pour votre message.
%p Je vous répondrais dès que possible.

View File

@ -0,0 +1,22 @@
%h3 Formulaire de contact
=form_tag create_public_contact_path, :method => :post do
%p{:style => "margin-top:0.5em;margin-bottom:0px;"}
%label Email :
=text_field_tag :mail, "", :placeholder => "Mail", :class => "validate[required]"
%p{:style => "margin-top:0.5em;margin-bottom:0px;"}
%label Sujet :
=text_field_tag :subject, "", :placeholder => "Sujet", :class => "validate[required]"
%p{:style => "margin-top:0.5em;margin-bottom:0px;"}
%label Message
=text_area_tag :message, "", :placeholder => "Message", :style => "height:10em;width:90%;"
%p Les champs marqués d'un * sont requis.
=submit_tag "Envoyer"
:javascript
$("form").validationEngine();

View File

@ -14,3 +14,5 @@
%br
%hr
=link_to "Reposoir", public_photos_path, :remote => true
%hr
=link_to "Contact", new_public_contact_path

View File

@ -3,6 +3,9 @@ CMSnb::Application.routes.draw do
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'public/menu_items#show'
@ -18,7 +21,17 @@ CMSnb::Application.routes.draw do
get 'rubriques/:id.html' => "public/portfolios#show", :as => "public_portfolio"
get "me-contacter.html" => "public/contact#new", :as => "new_public_contact"
post "me-contacter.html" => "public/contact#create", :as => "create_public_contact"
namespace :public do
get "contact/new"
post "contact/create"
resources :portfolios
resources :artworks