formulaire contact
This commit is contained in:
parent
8b2a8c139d
commit
1cedbaed2f
10
app/controllers/public/contact_controller.rb
Normal file
10
app/controllers/public/contact_controller.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class Public::ContactController < ApplicationController
|
||||
layout "public"
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
@params = params
|
||||
DemandeMail.prise(@params).deliver
|
||||
end
|
||||
end
|
10
app/mailers/demande_mail.rb
Normal file
10
app/mailers/demande_mail.rb
Normal 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
|
8
app/views/demande_mail/prise.html.haml
Normal file
8
app/views/demande_mail/prise.html.haml
Normal file
@ -0,0 +1,8 @@
|
||||
%p
|
||||
Email :
|
||||
=@params[:mail]
|
||||
%p
|
||||
Sujet :
|
||||
=@params[:subject]
|
||||
%hr
|
||||
=simple_format @params[:message]
|
2
app/views/public/contact/create.html.haml
Normal file
2
app/views/public/contact/create.html.haml
Normal file
@ -0,0 +1,2 @@
|
||||
%h2 Merci beaucoup pour votre message.
|
||||
%p Je vous répondrais dès que possible.
|
22
app/views/public/contact/new.html.haml
Normal file
22
app/views/public/contact/new.html.haml
Normal 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();
|
@ -14,3 +14,5 @@
|
||||
%br
|
||||
%hr
|
||||
=link_to "Reposoir", public_photos_path, :remote => true
|
||||
%hr
|
||||
=link_to "Contact", new_public_contact_path
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user