Skip to content

Instantly share code, notes, and snippets.

@roberttravispierce
Created June 14, 2017 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roberttravispierce/1458b669c42a79876417fd37e1d7150e to your computer and use it in GitHub Desktop.
Save roberttravispierce/1458b669c42a79876417fd37e1d7150e to your computer and use it in GitHub Desktop.
%section.page-header.page-header-sm.parallax.parallax-3{:style => "background-image:url(#{asset_path 'background2.jpg'})"}
.overlay.dark-2
.container
%h2.weight-300.text-white.wow.fadeInUp{"data-wow-delay" => "0.8s"} Connect with Silverlane
%section
.container
.row
.col-md-3.col-sm-3
%hr.margin-top-50/
%p
%span.block
%strong
%i.fa.fa-map-marker
Address:
%br/
4600 South Syracuse St., Floor 9
%br/
Denver, CO 80237
%span.block
%strong
%i.fa.fa-envelope
= mail_to Setting.contact_email, "Send an email >>", encode: "hex"
%span.block
%strong
%i.fa.fa-linkedin
= link_to 'LinkedIn Profile', Setting.linkedin_url, target: '_blank'
%hr/
.col-md-9.col-sm-9
%h4 Let us know the one thing that's holding your business back and we'll get back to you with some steps you can take right now.
= simple_form_for @contact do |f|
%fieldset
.row
.form-group
.col-md-4
= f.input :name, :required => true
.col-md-4
= f.input :email, :required => true
.col-md-4
= f.input :phone
.row
.form-group
.col-md-8
= f.input :subject
.col-md-4
= f.input :interest, collection: Contact::Interest.all
.row
.form-group
.col-md-12
= f.input :message, :as => :text, :required => true
.hidden
= f.input :nickname, :hint => 'Leave this field blank!'
.row
.col-md-12
= f.button :submit, 'Send message', :class=> "btn btn-primary"
class Contact < MailForm::Base
attribute :name, :validate => true
attribute :email, :validate => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
attribute :phone
attribute :subject
attribute :interest
attribute :message
attribute :nickname, :captcha => true
def headers
{
:subject => "Connect Message from Silverlane.io Site",
:to => Setting.contact_email,
:from => %("#{name}" <#{email}>)
}
end
class Interest
KEYS = [
CONSULTING = "Consulting",
AUDITING = "Auditing",
MANAGEMENT = "Management",
TRANSFORMATION = "Transformation",
INTEGRATION = "Integration",
COLLABORATION = "Collaboration",
ANALYTICS = "Analytics",
SECURITY = "Security",
TALENT = "Talent"
]
def self.keys
KEYS
end
def self.all
keys.map { |key| new(key) }
end
def initialize(key)
@key = key
end
# simple_form automatically uses `id` for the option value.
def id
@key
end
# simple_form automatically uses this for the option text.
def name
# I18n.t(@key, scope: :"models.order.interests")
@key
end
end
end
class ContactsController < ApplicationController
skip_before_action :authenticate_user!
def new
@contact = Contact.new
@page_title = t('page_title.contact')
end
def create
@contact = Contact.new(params[:contact])
@contact.request = request
if @contact.deliver
flash[:notice] = t('contacts.delivery')
redirect_to root_path
else
flash.now[:error] = t('contacts.error')
render :new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment