0.19
No release in over 3 years
Low commit activity in last 3 years
Reworked the contact_us gem to add a basic contact us form to Spree.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 1.0.0
 Project Readme

SpreeContactUs

Build Status

Adds configurable contact us form for Spree Commeerce applications.

Installation

In your Gemfile, add the following dependencies:

gem 'spree_contact_us', github: 'spree-contrib/spree_contact_us'

Run commands

bundle install
bundle exec rails g spree_contact_us:install

In config/initializers/spree_contact_us.rb modify:

config.mailer_to = "contact@please-change-me.com"

Change to the email address you would like to receive the form submissions at for example:

config.mailer_to = "contact@yourdomain.com"

By default the emails from field will be the email entered by the user to easily reply, but this may not be allowed if your required to verify your sending email addresses.

You may also specify an email address for the notification emails from field:

config.mailer_from = "dontreply@yourdomain.com"

Configuration

If you would like to add a name or subject field to the form you may simply set the options to true within the spree_contact_us initializer located at config/initializers/spree_contact_us.rb:

config.require_name = true
config.require_subject = true

You may also update your locales under config/locales/spree_contact_us.en.yml or create your own. Please feel free to submit your own locales so that other users will hopefully find this gem more useful.

Add a conversion tracking code

If you need to print a conversion tracking code on contact sent, you can setup a spree preference for this. Just open a Rails console in your application and launch:

Spree::ContactUs::Config[:contact_tracking_message] = 'nothing special'

Everything that is not an empty string will cause a flash ("contact_tracking") message to be created. You can use it somewhere in your layout like this:

  <% if flash[:contact_tracking] %>
      put your conversion tracking code here
  <% end %>

By default the preference has an empty string value so no flash messages will be created until you don't need it.

Usage

Visit your website and navigate to /contact-us to see the form in action.

Be aware that stylesheet customization would be required as the contact-us class does not automatically inherit all the necessary styles.

Refer to Spree Guide on how to go about it.

Issues

Please report any bugs or feature requests to the Github issues page @ https://github.com/spree-contrib/spree_contact_us/issues

Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

bundle install
bundle exec rake test_app
bundle exec rspec spec

TODO

  • Modify settings within the admin
  • Add new language translations

Contributing

In the spirit of free software, everyone is encouraged to help improve this project.

Here are some ways you can contribute:

  • by using prerelease versions
  • by reporting bugs
  • by suggesting new features
  • by translating to a new language
  • by writing or editing documentation
  • by writing specifications
  • by writing code (no patch is too small: fix typos, add comments, clean up inconsistent whitespace)
  • by refactoring code
  • by resolving issues
  • by reviewing patches

Copyright

Copyright (c) 2012-2020 Jeff Dutil & contributors, released under the New BSD License.