diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index 665fea1..3092e9e 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -18,6 +18,10 @@ $orange: rgba(251,163,58,1); @import "public/flexslider"; @import "public/label"; + +@import "shared/formtastic"; +@import "bootstrap/bootstrap"; + $blue :rgba(26,147,166,1); .clear{ @@ -101,7 +105,7 @@ h1,h2,h3{ font-size:0.9em; position:relative; #certif{ - width:230px; + width:300px; position:absolute; bottom:0; right:0; @@ -144,27 +148,7 @@ h1,h2,h3{ #home_slider{ - position:relative; - .bouvier-signa{ - position:absolute; - bottom:10px; - height:30px; - left:10px; - z-index:100; - } - .certif{ - position:absolute; - z-index:100; - bottom:0px; - width:170px; - right:0px; - opacity:0.8; - - &:hover{ - opacity:1; - } - - } + .inner{ background:black center center no-repeat; background-size:100%; @@ -174,6 +158,35 @@ h1,h2,h3{ } } +#slider_bottom{ + position:relative; + + height:55px; + background:#5d5d5d; + + + .bouvier-signa{ + position:absolute; + bottom:10px; + height:35px; + left:10px; + z-index:100; + } + .certif{ + position:absolute; + z-index:100; + bottom:2px; + width:230px; + right:0px; + + + &:hover{ + opacity:1; + } + + } + +} .q_counter_holder{ text-align:center; @@ -183,17 +196,20 @@ h1,h2,h3{ .socials_links{ text-align:right; margin-right:10px; + position:absolute; + right:10px; + bottom:120px; a, .top_link{ display:inline-block; padding:10px 0px; text-align:center; width:45px; - color:#9d9d9d; - border: 2px solid #9d9d9d; + color:white; + border: 2px solid white; margin:10px 5px; cursor:pointer; &:hover{ - background:#9d9d9d; + background:white; color:white; } @@ -243,4 +259,46 @@ h1,h2,h3{ background-size:cover; } color:#8d8d8d; -}} \ No newline at end of file +}} + +.contact_form{ + + padding-bottom:2em; +#form{ +h3, p{ +text-align:left; +} + +} +.label{ + font-weight:normal; +width:120px; +float:left; + +} +input{ +width:450px; +float: right; +} + +.btn{ +width:auto; +background:#dd7425; +border:2px solid #dd7425; +border-radius:0; +color:white; + +text-transform:uppercase; +padding:10px 20px; +&:hover{ + color:#dd7425; + background:white; + + + + +} +float:left; + +} +} \ No newline at end of file diff --git a/app/assets/stylesheets/shared/formtastic.scss b/app/assets/stylesheets/shared/formtastic.scss new file mode 100644 index 0000000..1f15de8 --- /dev/null +++ b/app/assets/stylesheets/shared/formtastic.scss @@ -0,0 +1,145 @@ +/* ------------------------------------------------------------------------------------------------- + +It's *strongly* suggested that you don't modify this file. Instead, load a new stylesheet after +this one in your layouts (eg formtastic_changes.css) and override the styles to suit your needs. +This will allow you to update formtastic.css with new releases without clobbering your own changes. + +This stylesheet forms part of the Formtastic Rails Plugin +(c) 2008 Justin French + +--------------------------------------------------------------------------------------------------*/ + + +/* NORMALIZE AND RESET - obviously inspired by Yahoo's reset.css, but scoped to just form.formtastic +--------------------------------------------------------------------------------------------------*/ +form.formtastic, form.formtastic ul, form.formtastic ol, form.formtastic li, form.formtastic fieldset, form.formtastic legend, form.formtastic textarea, form.formtastic select, form.formtastic p { margin:0; padding:0; } +form.formtastic fieldset { border:0; } +form.formtastic em, form.formtastic strong { font-style:normal; font-weight:normal; } +form.formtastic ol, form.formtastic ul { list-style:none; } +form.formtastic abbr, form.formtastic acronym { border:0; font-variant:normal; } +form.formtastic input, form.formtastic textarea, form.formtastic select { font-family:inherit; font-size:inherit; font-weight:inherit; } +form.formtastic input, form.formtastic textarea, form.formtastic select { font-size:100%; } +form.formtastic legend { white-space:normal; color:#000; } + + +/* SEMANTIC ERRORS +--------------------------------------------------------------------------------------------------*/ +form.formtastic ul.errors { color:#cc0000; margin:0.5em 0 1.5em 25%; list-style:square; } +form.formtastic ul.errors li { padding:0; border:none; display:list-item; } + + +/* FIELDSETS & LISTS +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset { overflow:auto; } /* clearing contained floats */ +form.formtastic fieldset.inputs { } +form.formtastic fieldset.buttons { padding-left:25%; } +form.formtastic fieldset ol { } +form.formtastic fieldset.buttons li { float:left; padding-right:0.5em; } + +/* INPUT LIs +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li { padding:0.5em 0; margin-top:-0.5em; margin-bottom:1em; } /* padding and negative margin juggling is for Firefox */ +form.formtastic fieldset > ol > li { overflow:auto; } /* clearing contained floats */ + +form.formtastic fieldset > ol > li.required { } +form.formtastic fieldset > ol > li.optional { } +form.formtastic fieldset > ol > li.error { } + + +/* LABELS +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li label { display:block; width:25%; float:left; padding-top:.2em; } +form.formtastic fieldset > ol > li > li label { line-height:100%; padding-top:0; } +form.formtastic fieldset > ol > li > li label input { line-height:100%; vertical-align:middle; margin-top:-0.1em;} + + +/* NESTED FIELDSETS AND LEGENDS (radio, check boxes and date/time inputs use nested fieldsets) +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li fieldset { position:relative; } +form.formtastic fieldset > ol > li fieldset legend { position:absolute; width:95%; padding-top:0.1em; left: 0px; } +form.formtastic fieldset > ol > li fieldset legend span { position:absolute; } +form.formtastic fieldset > ol > li fieldset legend.label label { position:absolute; } +form.formtastic fieldset > ol > li fieldset ol { float:left; width:74%; margin:0; padding:0 0 0 25%; } +form.formtastic fieldset > ol > li fieldset ol li { padding:0; border:0; } + + +/* INLINE HINTS +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li p.inline-hints { color:#666; margin:0.5em 0 0 25%; } + + +/* INLINE ERRORS +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li p.inline-errors { color:#cc0000; margin:0.5em 0 0 25%; } +form.formtastic fieldset > ol > li ul.errors { color:#cc0000; margin:0.5em 0 0 25%; list-style:square; } +form.formtastic fieldset > ol > li ul.errors li { padding:0; border:none; display:list-item; } + + +/* STRING, NUMERIC, PASSWORD, EMAIL, URL, PHONE & SEARCH OVERRIDES +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li.string input, +form.formtastic fieldset > ol > li.password input, +form.formtastic fieldset > ol > li.numeric input, +form.formtastic fieldset > ol > li.email input, +form.formtastic fieldset > ol > li.url input, +form.formtastic fieldset > ol > li.phone input, +form.formtastic fieldset > ol > li.search input { width:72%; } + +form.formtastic fieldset > ol > li.string input[size], +form.formtastic fieldset > ol > li.password input[size], +form.formtastic fieldset > ol > li.numeric input[size], +form.formtastic fieldset > ol > li.email input[size], +form.formtastic fieldset > ol > li.url input[size], +form.formtastic fieldset > ol > li.phone input[size], +form.formtastic fieldset > ol > li.search input[size] { width:auto; max-width:72%; } + + +/* TEXTAREA OVERRIDES +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li.text textarea { width:72%; } +form.formtastic fieldset > ol > li.text textarea[cols] { width:auto; max-width:72%; } + + +/* HIDDEN OVERRIDES +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset ol li.hidden { display:none; } + +/* BOOLEAN OVERRIDES +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li.boolean label { padding-left:25%; width:auto; } +form.formtastic fieldset > ol > li.boolean label input { margin:0 0.5em 0 0.2em; } + + +/* RADIO OVERRIDES +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li.radio { } +form.formtastic fieldset > ol > li.radio fieldset { overflow:visible; } +form.formtastic fieldset > ol > li.radio fieldset ol { margin-bottom:-0.5em; } +form.formtastic fieldset > ol > li.radio fieldset ol li { margin:0.1em 0 0.5em 0; overflow:visible; } +form.formtastic fieldset > ol > li.radio fieldset ol li label { float:none; width:100%; } +form.formtastic fieldset > ol > li.radio fieldset ol li label input { margin-right:0.2em; } + + +/* CHECK BOXES (COLLECTION) OVERRIDES +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li.check_boxes { } +form.formtastic fieldset > ol > li.check_boxes fieldset { overflow:visible; } +form.formtastic fieldset > ol > li.check_boxes fieldset ol { margin-bottom:-0.5em; } +form.formtastic fieldset > ol > li.check_boxes fieldset ol li { margin:0.1em 0 0.5em 0; overflow:visible; } +form.formtastic fieldset > ol > li.check_boxes fieldset ol li label { float:none; width:100%; } +form.formtastic fieldset > ol > li.check_boxes fieldset ol li label input { margin-right:0.2em; } + + +/* DATE & TIME OVERRIDES +--------------------------------------------------------------------------------------------------*/ +form.formtastic fieldset > ol > li.date fieldset ol li, +form.formtastic fieldset > ol > li.time fieldset ol li, +form.formtastic fieldset > ol > li.datetime fieldset ol li { float:left; width:auto; margin:0 .3em 0 0; } + +form.formtastic fieldset > ol > li.date fieldset ol li label, +form.formtastic fieldset > ol > li.time fieldset ol li label, +form.formtastic fieldset > ol > li.datetime fieldset ol li label { display:none; } + +form.formtastic fieldset > ol > li.date fieldset ol li label input, +form.formtastic fieldset > ol > li.time fieldset ol li label input, +form.formtastic fieldset > ol > li.datetime fieldset ol li label input { display:inline; margin:0; padding:0; } diff --git a/app/controllers/public/contacts_controller.rb b/app/controllers/public/contacts_controller.rb new file mode 100644 index 0000000..13e0b51 --- /dev/null +++ b/app/controllers/public/contacts_controller.rb @@ -0,0 +1,26 @@ +class Public::ContactsController < ApplicationController + layout "public" + + def index + + end + + def new + @contact = Contact.new + end + def create + @contact = Contact.new(params.require(:contact).permit(:website, :place, :tel, :name, :email, :message)) + + + if @contact.save + QuestionMailer.send_contact(@contact).deliver + + render :action => :create + else + + render :action => :new + end + + end + +end diff --git a/app/mailers/question_mailer.rb b/app/mailers/question_mailer.rb new file mode 100644 index 0000000..38c609c --- /dev/null +++ b/app/mailers/question_mailer.rb @@ -0,0 +1,16 @@ +class QuestionMailer < ActionMailer::Base + default from: "contact@bouvier-signa.com" + + # Subject can be set in your I18n file at config/locales/en.yml + # with the following lookup: + # + # en.question.deliver.subject + # + def send_contact(contact) + @contact = contact + + mail to: "test@nicolasbally.com", :bcc => "info@nicolasbally.com" ,:reply_to => @contact.email, :subject => "Nouveau mail par le site" + end + + +end diff --git a/app/models/contact.rb b/app/models/contact.rb new file mode 100644 index 0000000..ea4833f --- /dev/null +++ b/app/models/contact.rb @@ -0,0 +1,8 @@ +class Contact < ActiveRecord::Base + + validates :name, :presence => true + validates :email, :presence => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i + validates :message, :presence => true + validates :tel, :presence => true + +end diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 04d4840..30d973d 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -66,10 +66,7 @@ #home_slider - =link_to "/fr/contact.html" do - =image_tag("/certif.png", :class => "certif") - =link_to image_tag("/bouvier-signaletique.png", :class => "bouvier-signa", :style => ""), "http://www.bouvier-signa.com", :target => "_blank" .flexslider @@ -93,7 +90,11 @@ .inner{:style => "background-image:url('#{home_slider_slide.image_file.file.url}');"} - + #slider_bottom + =link_to "/fr/contact.html" do + =image_tag("/certif.png", :class => "certif") + + =link_to image_tag("/bouvier-signaletique.png", :class => "bouvier-signa", :style => ""), "http://www.bouvier-signa.com", :target => "_blank" @@ -119,6 +120,9 @@ .clear + + .bottom + .socials_links =link_to "https://www.facebook.com/sharer/sharer.php?u=#{request.url}", :target => "_blank", :class => "link facebook" do @@ -129,8 +133,8 @@ .top_link =i(:"arrow-up") - - .bottom + + =link_to "/fr/contact.html" do =image_tag("/certif.png", :id => "certif") diff --git a/app/views/public/contacts/_form.html.haml b/app/views/public/contacts/_form.html.haml new file mode 100644 index 0000000..6d55a2e --- /dev/null +++ b/app/views/public/contacts/_form.html.haml @@ -0,0 +1,9 @@ +- @contact = @contact || Contact.new +=semantic_form_for [:public, @contact], :remote => true do |f| + =f.inputs do + =f.input :name, :label => "Nom :" + =f.input :email, :label => "Email :" + =f.input :tel, :label => "Téléphone :" + =f.input :message, :label => "Message :" + =f.submit "Contactez-nous", :class => "btn" + diff --git a/app/views/public/contacts/_thank.html.haml b/app/views/public/contacts/_thank.html.haml new file mode 100644 index 0000000..fbdfe2a --- /dev/null +++ b/app/views/public/contacts/_thank.html.haml @@ -0,0 +1,2 @@ +%h3 Merci pour votre message +%p Nous vous remercions pour votre message et vous répondrons dans les meilleurs délais. \ No newline at end of file diff --git a/app/views/public/contacts/create.js.erb b/app/views/public/contacts/create.js.erb new file mode 100644 index 0000000..3593d10 --- /dev/null +++ b/app/views/public/contacts/create.js.erb @@ -0,0 +1 @@ +$("#form").html("<%= escape_javascript(render(:partial => "thank")) %>"); \ No newline at end of file diff --git a/app/views/public/contacts/index.haml b/app/views/public/contacts/index.haml new file mode 100644 index 0000000..edc43c2 --- /dev/null +++ b/app/views/public/contacts/index.haml @@ -0,0 +1,7 @@ +%h2 Merci beaucoup +%p{:style => "text-align:center;"} + %br + Votre message m'a bien été envoyé, j'y répondrais dès que possible ! +%br +%br +%br diff --git a/app/views/public/contacts/new.js.erb b/app/views/public/contacts/new.js.erb new file mode 100644 index 0000000..4987893 --- /dev/null +++ b/app/views/public/contacts/new.js.erb @@ -0,0 +1 @@ +$("#form").html("<%= escape_javascript(render(:partial => "form")) %>"); \ No newline at end of file diff --git a/app/views/public/menu_items/show.html.haml b/app/views/public/menu_items/show.html.haml index ee58eae..243e1d3 100644 --- a/app/views/public/menu_items/show.html.haml +++ b/app/views/public/menu_items/show.html.haml @@ -58,7 +58,29 @@ =yield :corps - +-if params[:url] == "contact" + .center + .row + .columns.span_4 + %p + %strong Bouvier signalétique + %p + + Zone Actipôle, 4/6 boulevard Beaubourg + %br + 77183 CROISSY BEAUBOURG + %p + Tél. 0(33) 1 60 17 91 76 + %br + Fax. 0(33) 1 64 11 22 03 + %p + email : + =link_to "signa@bouvier-signa.com", "mailto:signa@bouvier-signa.com" + + .columns.span_8 + .contact_form + #form=render :partial => "public/contacts/form" + -if @sidebar diff --git a/app/views/question_mailer/send_contact.html.haml b/app/views/question_mailer/send_contact.html.haml new file mode 100644 index 0000000..95f8838 --- /dev/null +++ b/app/views/question_mailer/send_contact.html.haml @@ -0,0 +1,9 @@ +%p + Contact de + %strong=@contact.name + +%p + Téléphone + %strong=@contact.tel +%hr +=simple_format @contact.message \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 98a971b..24845f1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -61,6 +61,7 @@ Rails.application.routes.draw do get 'parrainage' => "public/sponsorship_animals#index", :as => :public_sponsorship_animals get "sitemap.:f" => "public/sitemap#sitemap" namespace :public do + resources :contacts resources :press_releases resources :label_produits do collection do diff --git a/db/migrate/20160217161703_create_contacts.rb b/db/migrate/20160217161703_create_contacts.rb new file mode 100644 index 0000000..539dae0 --- /dev/null +++ b/db/migrate/20160217161703_create_contacts.rb @@ -0,0 +1,13 @@ +class CreateContacts < ActiveRecord::Migration + def change + create_table :contacts do |t| + t.string :name + t.string :email + t.string :tel + t.string :website + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20160217161704_add_infos_to_contacts.rb b/db/migrate/20160217161704_add_infos_to_contacts.rb new file mode 100644 index 0000000..d2f36cd --- /dev/null +++ b/db/migrate/20160217161704_add_infos_to_contacts.rb @@ -0,0 +1,12 @@ +class AddInfosToContacts < ActiveRecord::Migration + def change + add_column :contacts, :address, :string + add_column :contacts, :address2, :string + add_column :contacts, :cp, :string + add_column :contacts, :city, :string + add_column :contacts, :country, :string + add_column :contacts, :notes, :text + add_column :contacts, :statut, :string + add_column :contacts, :readed, :boolean + end +end diff --git a/db/migrate/20160217161705_add_place_to_contacts.rb b/db/migrate/20160217161705_add_place_to_contacts.rb new file mode 100644 index 0000000..0990994 --- /dev/null +++ b/db/migrate/20160217161705_add_place_to_contacts.rb @@ -0,0 +1,5 @@ +class AddPlaceToContacts < ActiveRecord::Migration + def change + add_column :contacts, :place, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index a8c9884..2b417c8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160217161702) do +ActiveRecord::Schema.define(version: 20160217161705) do create_table "admins", force: :cascade do |t| t.string "name", limit: 255 @@ -166,6 +166,25 @@ ActiveRecord::Schema.define(version: 20160217161702) do t.boolean "newsletter", limit: 1 end + create_table "contacts", force: :cascade do |t| + t.string "name", limit: 255 + t.string "email", limit: 255 + t.string "tel", limit: 255 + t.string "website", limit: 255 + t.text "message", limit: 65535 + t.datetime "created_at" + t.datetime "updated_at" + t.string "address", limit: 255 + t.string "address2", limit: 255 + t.string "cp", limit: 255 + t.string "city", limit: 255 + t.string "country", limit: 255 + t.text "notes", limit: 65535 + t.string "statut", limit: 255 + t.boolean "readed", limit: 1 + t.string "place", limit: 255 + end + create_table "data_file_categories", force: :cascade do |t| t.string "name", limit: 255 t.string "slug", limit: 255 diff --git a/public/bouvier-signaletique.psd b/public/bouvier-signaletique.psd new file mode 100644 index 0000000..0837efc Binary files /dev/null and b/public/bouvier-signaletique.psd differ diff --git a/public/certif.psd b/public/certif.psd new file mode 100644 index 0000000..471ed0e Binary files /dev/null and b/public/certif.psd differ