A Mountable Contact Form...
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config/locales
lib
.gitignore
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
mountable_contact.gemspec

README.md

MountableContact

Mountable Contact is Selectra's Contact Solution.

Installation

Add the selectra gems source to your Gemfile :

source 'http://gems.selectra.info'

Then add the gem to your Gemfile :

gem 'mountable_contact'

Usage

Add this to your routes.rb file, replace /contact by the url you want to use :

contact_at('/contact')

Visit http://yourapp/contact, that's it !

Configuration

You can customize the behavior of MountableContact with the following variables in an initializer:

# config/initializers/mountable_contact.rb
MountableContact.configure do |config|
  # Address to which contact messages are sent
  config.destination_email = "Contact Us <contact-us@example.com>"

  # An I18n string to be called to set the email title
  config.email_title = 'contact_mail_title' #

  # Email address used as sender when no email address was given
  config.default_sender = "John Doe <john-doe@example.com>"
end

Customizing the view

You can override the different views.

contacts/new

By default the contacts/new page simply calls a partial containing the contact form. Therefore, you can simply copy the following line in your own app/views/contacts/new.html.erb and put whatever you want around it !

<%= render partial: 'new', locals: { contact: @contact } %>

The notification mail

You can override the template of the notification e-mail sent when a message is added. To do so, just write your own app/views/contact_mailer/contact_notification.html.erb and app/views/contact_mailer/contact_notification.text.erb.

You have access to a @sender variable which contains the user's name in @sender.name and the message in @sender.content.