Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby on Rails Contacts extension for Refinery CMS
Ruby JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app add default scope order position DESC - show last contact on the begi…
db init commit
script init commit
spec init commit
tasks init commit
Gemfile init commit
Guardfile init commit
Rakefile init commit add changelog for 0.1.2 v 0.1.1
refinerycms-contacts.gemspec fix homepage url in gemspec

Refinery CMS Contacts

Contacts engine for Refinery CMS.

Attach contact form to any page with contact information


This version supports Rails 3.2.x and Refinery CMS ~> 2.0.9. (Should work with ~> 2.0.0, not tested)


  • create contact, contact has many email address
  • contact can be attached to many pages
  • rendering contact form with contact info ( optional )
  • send email
  • server side validation, client side validation ( optional )
  • recaptcha
  • email obfuscation in selectbox on frontend


All screenshots are in branch screenshots

Edit contact Attach contact to page Frontend show


Gem is translated to slovak and english.


Gem + migrations

Open up your Gemfile and add at the bottom this line:

gem 'refinerycms-contacts', '~> 0.1.0'

Now, run

bundle install

Next, to install run:

 rails g refinery:contacts

Run database migrations:

rake db:migrate

Seed your database:

rake db:seed

Assets + views

If you don't have Chosen JS included in your backend yet, append this code to your_app/config/initializers/refinery/core.rb

 config.register_javascript "refinery/contacts/admin/jquery.chosen.min.js"
 config.register_stylesheet "refinery/contacts/admin/chosen.css"

To view/refinery/pages/show.html.erb add <%= render "/refinery/contacts/contacts/show" %>

To your app stylesheet manifest add *= require refinery/contacts/contacts To your app javascript manifest add //= require refinery/contacts/contacts


Register your reCaptcha code at and set-up it in config/initializers/recaptcha.rb If you want, add that initializer file to .gitignore or rewrite it to use ENV variables from gitignored YAML file

Send mail testing

If you want to test mail sending in development I recommend to use gem letter_opener. In app/config/environments/development.rb add these lines:

config.action_mailer.delivery_method = :letter_opener
config.action_mailer.raise_delivery_errors = true

If you have set-up ActionMailer::Base.smtp_settings block for development mode, comment it.

Configure mailers

You can override mailer views from folder views/refinery/contacts/contact_mailer and edit.

Client side validations

Client side validations gem is not installed by default by refinerycms-contacts gem! You need to install it:

Include ClientSideValidations in your Gemfile

gem 'client_side_validations', '~> 3.2.1'

Then run the install generator

rails g client_side_validations:install

This will install the initializer:



Because of some issues we must delete that initializer and write this code into file config/application.rb :

config.to_prepare do
      ActionView::Base.field_error_proc = do |html_tag, instance|
        unless html_tag =~ /^<label/
          %{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
          %{<div class="field_with_errors">#{html_tag}</div>}.html_safe

Add JS to your manifest:

//= require rails.validations

In file config/initializers/refinery/contacts.rb set client_side_validations to true to don't show server-side validation error in errorExplanations div

config.client_side_validations = true

Precompile assets

Before production, don't forget to precompile assets by:

rake assets:precompile

Todo list

  • add js pop-up in page's tab to allow create contact "in-place" instead of clicking through menu
  • tests :(


Code Climate

Known bugs

  • WymEditor tab name don't show title in correct current_locale
  • reCaptcha validation shows errors both for incorrect-captcha-sol and verification_failed key




Refinery CMS Contacts engine is released under the MIT license. Created by Martin Markech

Something went wrong with that request. Please try again.