diff --git a/app/controllers/public/contact_controller.rb b/app/controllers/public/contact_controller.rb new file mode 100644 index 0000000..3d04fca --- /dev/null +++ b/app/controllers/public/contact_controller.rb @@ -0,0 +1,10 @@ +class Public::ContactController < ApplicationController + layout "public" + def new + end + + def create + @params = params + DemandeMail.prise(@params).deliver + end +end diff --git a/app/mailers/demande_mail.rb b/app/mailers/demande_mail.rb new file mode 100644 index 0000000..cb5701b --- /dev/null +++ b/app/mailers/demande_mail.rb @@ -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 diff --git a/app/views/demande_mail/prise.html.haml b/app/views/demande_mail/prise.html.haml new file mode 100644 index 0000000..5283efd --- /dev/null +++ b/app/views/demande_mail/prise.html.haml @@ -0,0 +1,8 @@ +%p + Email : + =@params[:mail] +%p + Sujet : + =@params[:subject] +%hr +=simple_format @params[:message] diff --git a/app/views/public/contact/create.html.haml b/app/views/public/contact/create.html.haml new file mode 100644 index 0000000..54175ef --- /dev/null +++ b/app/views/public/contact/create.html.haml @@ -0,0 +1,2 @@ +%h2 Merci beaucoup pour votre message. +%p Je vous répondrais dès que possible. \ No newline at end of file diff --git a/app/views/public/contact/new.html.haml b/app/views/public/contact/new.html.haml new file mode 100644 index 0000000..a8c7503 --- /dev/null +++ b/app/views/public/contact/new.html.haml @@ -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(); \ No newline at end of file diff --git a/app/views/public/shared/_first_menu.html.haml b/app/views/public/shared/_first_menu.html.haml index def4de7..97428cd 100644 --- a/app/views/public/shared/_first_menu.html.haml +++ b/app/views/public/shared/_first_menu.html.haml @@ -14,3 +14,5 @@ %br %hr =link_to "Reposoir", public_photos_path, :remote => true +%hr +=link_to "Contact", new_public_contact_path diff --git a/config/routes.rb b/config/routes.rb index b6ec22e..a9c27f8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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