contact_us 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +5 -4
- data/{CHANGELOG → CHANGELOG.md} +14 -19
- data/README.md +62 -21
- data/app/controllers/contact_us/contacts_controller.rb +1 -1
- data/app/models/contact_us/contact.rb +2 -2
- data/app/views/contact_us/contacts/new_simple_form.html.erb +1 -1
- data/config/locales/contact_us.de.yml +4 -4
- data/config/locales/contact_us.pl.yml +25 -0
- data/config/locales/contact_us.pt-BR.yml +6 -6
- data/config/locales/contact_us.pt-PT.yml +25 -0
- data/config/locales/contact_us.ru.yml +25 -0
- data/config/routes.rb +1 -1
- data/contact_us.gemspec +7 -6
- data/lib/contact_us/version.rb +1 -1
- data/lib/contact_us.rb +3 -0
- data/lib/templates/contact_us.rb +4 -1
- data/spec/controllers/contact_us/contact_controller_spec.rb +13 -0
- data/spec/{integration → features}/contact_us_lint_spec.rb +0 -0
- data/spec/lib/contact_us_spec.rb +1 -0
- metadata +28 -44
- data/.rvmrc +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 61abfb977113488f9b95392400ad9b9cccc2f5b3
|
4
|
+
data.tar.gz: d01031a28441401a6aa31cc70cb2904cfc27afac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8148fca88daf3dd2b12f8d5abdea72dfaa77f18a31e626b923620b87acae0c5bd979741e15eaf043f4c3c4759cb7d013136893f9d2bb7d01396dcc585cc78ebf
|
7
|
+
data.tar.gz: f01a43448aad755739c1f1fa0d88d0651b986448a91e110f18e4c7c7d6d7b49cf458428ef30e9a1ad84d4c36d9961e4d24ba82a19b3793eb4a89c7cf0c4bed6b
|
data/.travis.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
script: "bundle exec rspec spec"
|
2
2
|
rvm:
|
3
|
-
- 1.8.7
|
4
|
-
- 1.9.2
|
5
3
|
- 1.9.3
|
6
|
-
-
|
7
|
-
|
4
|
+
- 2.0.0
|
5
|
+
- ruby-head
|
8
6
|
language: ruby
|
7
|
+
matrix:
|
8
|
+
allow_failures:
|
9
|
+
- rvm: ruby-head
|
9
10
|
notifications:
|
10
11
|
recipients:
|
11
12
|
- JDutil@BurlingtonWebApps.com
|
data/{CHANGELOG → CHANGELOG.md}
RENAMED
@@ -1,51 +1,46 @@
|
|
1
|
-
|
1
|
+
## ContactUs 0.5.0 (Nov 19th 2013)
|
2
2
|
|
3
|
-
*
|
3
|
+
* Require Ruby >= 1.9.3 going forward. [Jeff Dutil]
|
4
|
+
* Updates for Rails 4 compatibility [flyerhzm]
|
4
5
|
|
5
|
-
|
6
|
+
## ContactUs 0.4.0 (Oct 29th 2012)
|
6
7
|
|
8
|
+
* Add default rails form helper support and remove Formtastic dependency. [Jeff Dutil]
|
9
|
+
* Added support for SimpleForm. [flyerhzm]
|
7
10
|
* Added Japanese locale. [yosiyuki]
|
8
|
-
|
9
11
|
* Added French locale. [bgantaume]
|
10
|
-
|
11
12
|
* No longer copy default views & locales during installation. Copy manually with rake tasks when wanting to customize now. [Jeff Dutil]
|
12
13
|
|
13
|
-
|
14
|
+
## ContactUs 0.3.0 (May 15th 2012)
|
14
15
|
|
15
|
-
* Changed route to /contact-us from /
|
16
|
+
* Changed route to /contact-us from /contact_us for seo. [Jeff Dutil]
|
16
17
|
|
17
|
-
|
18
|
+
## ContactUs 0.2.1 (May 4th 2012)
|
18
19
|
|
19
20
|
* Use the users provided email address in the email notifications reply_to field. [Jeff Dutil]
|
20
21
|
|
21
|
-
|
22
|
+
## ContactUs 0.2.0 (February 25th 2012)
|
22
23
|
|
23
24
|
* Added ContactUs.mailer_from setting in order to send from verified address, which is better practice than pretending the email is from the user. [Jeff Dutil]
|
24
|
-
|
25
25
|
* Added ContactUs.require_name setting in order to ask for the name with the contact form. [Jeff Dutil]
|
26
|
-
|
27
26
|
* Added ContactUs.require_subject setting in order to for the subject with the contact form. [Jeff Dutil]
|
28
|
-
|
29
27
|
* Formtastic dependency updated to >= 2.1.0 in order to fix commit_button deprecation. [Jeff Dutil]
|
30
28
|
|
31
|
-
|
29
|
+
## ContactUs 0.1.5 (January 6th, 2012)
|
32
30
|
|
33
31
|
* Added Chinese zh locale [kinopyo]
|
34
32
|
|
35
|
-
|
33
|
+
## ContactUs 0.1.4 (September 26th, 2011)
|
36
34
|
|
37
35
|
* Added German locale
|
38
|
-
|
39
36
|
* Email subject is now included in i18n
|
40
37
|
|
41
|
-
|
38
|
+
## ContactUs 0.1.3 (September 2, 2011)
|
42
39
|
|
43
40
|
* Added Brazilian Portuguese locale [brunoarueira]
|
44
|
-
|
45
41
|
* Added Spanish locale [igmarin]
|
46
|
-
|
47
42
|
* Added Italian locale [igmarin]
|
48
43
|
|
49
|
-
|
44
|
+
## ContactUs 0.1.2 (August 18, 2011)
|
50
45
|
|
51
46
|
* 100% Test Coverage under Ruby 1.8.7, 1.9.2, 1.9.3, REE, ruby-head, rbx-2.0 [Jeff Dutil]
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Contact Us [![Build Status](https://secure.travis-ci.org/jdutil/contact_us.png)](http://travis-ci.org/jdutil/contact_us) [![Dependency Status](https://gemnasium.com/jdutil/contact_us.png?travis)](https://gemnasium.com/jdutil/contact_us) [![Click here to lend your support to: ContactUs and make a donation at www.pledgie.com !](
|
1
|
+
# Contact Us [![Build Status](https://secure.travis-ci.org/jdutil/contact_us.png)](http://travis-ci.org/jdutil/contact_us) [![Dependency Status](https://gemnasium.com/jdutil/contact_us.png?travis)](https://gemnasium.com/jdutil/contact_us) [![Click here to lend your support to: ContactUs and make a donation at www.pledgie.com !](http://www.pledgie.com/campaigns/16807.png?skin_name=chrome)][pledgie]
|
2
2
|
A Rails 3+ Engine providing a basic contact form.
|
3
3
|
|
4
4
|
[travis]: http://travis-ci.org/jdutil/contact_us
|
@@ -14,7 +14,7 @@ There is also a demo application showing how the ContactUs form works:
|
|
14
14
|
|
15
15
|
Contact Us requires:
|
16
16
|
|
17
|
-
* Ruby >= 1.
|
17
|
+
* Ruby >= 1.9.3
|
18
18
|
* Rails >= 3.0.0
|
19
19
|
|
20
20
|
It is also recommended to use Formtastic or SimpleForm (see configuration) in order to hook into your apps custom form builders.
|
@@ -23,45 +23,66 @@ It is also recommended to use Formtastic or SimpleForm (see configuration) in or
|
|
23
23
|
|
24
24
|
In your `Gemfile`, add the following dependencies:
|
25
25
|
|
26
|
-
|
26
|
+
```ruby
|
27
|
+
gem 'contact_us', '~> 0.4.0'
|
28
|
+
```
|
27
29
|
|
28
|
-
From `Rails.root` run:
|
30
|
+
From `Rails.root` in your Terminal run:
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
+
```shell
|
33
|
+
bundle
|
34
|
+
bundle exec rake contact_us:install
|
35
|
+
```
|
32
36
|
|
33
37
|
In `config/initializers/contact_us.rb` modify:
|
34
38
|
|
35
|
-
|
39
|
+
```ruby
|
40
|
+
config.mailer_to = "contact@please-change-me.com"
|
41
|
+
```
|
36
42
|
|
37
43
|
Change to the email address you would like to receive the form submissions at for example:
|
38
44
|
|
39
|
-
|
45
|
+
```ruby
|
46
|
+
config.mailer_to = "contact@yourdomain.com"
|
47
|
+
```
|
40
48
|
|
41
49
|
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.
|
42
50
|
You may also specify an email address for the notification emails from field:
|
43
51
|
|
44
|
-
|
52
|
+
```ruby
|
53
|
+
config.mailer_from = "dontreply@yourdomain.com"
|
54
|
+
```
|
45
55
|
|
46
56
|
## CONFIGURATION
|
47
57
|
|
48
58
|
If you would like to add a name or subject field to the form you may simply
|
49
59
|
set the options to true within the contact_us initializer located at `config/initializers/contact_us.rb`:
|
50
60
|
|
51
|
-
|
52
|
-
|
61
|
+
```ruby
|
62
|
+
config.require_name = true
|
63
|
+
config.require_subject = true
|
64
|
+
```
|
65
|
+
|
66
|
+
To redirect to a specific URL after a successful form submission:
|
67
|
+
```ruby
|
68
|
+
config.success_redirect = '/contact-success'
|
69
|
+
```
|
53
70
|
|
54
71
|
### Views
|
55
72
|
|
56
73
|
To copy the view files to `app/views/contact_us`, and customize them to suit your needs run:
|
57
74
|
|
58
|
-
|
75
|
+
```shell
|
76
|
+
bundle exec rake contact_us:copy_views
|
77
|
+
```
|
59
78
|
|
60
79
|
### Locales
|
61
80
|
|
62
81
|
To copy the locale files to `config/locales/contact_us.*.yml`, and customize them to suit your needs run:
|
63
82
|
|
64
|
-
|
83
|
+
```shell
|
84
|
+
bundle exec rake contact_us:copy_locales
|
85
|
+
```
|
65
86
|
|
66
87
|
Please feel free to submit your own locales so that other users will hopefully find this gem more useful in your language.
|
67
88
|
|
@@ -69,7 +90,9 @@ Please feel free to submit your own locales so that other users will hopefully f
|
|
69
90
|
|
70
91
|
In order to use a Formtastic compatible template to hook into your custom form styles configure `config/initializers/contact_us.rb`:
|
71
92
|
|
72
|
-
|
93
|
+
```ruby
|
94
|
+
config.form_gem = 'formtastic'
|
95
|
+
```
|
73
96
|
|
74
97
|
* By default the HTML should match that produced by Formtastic, but to ensure it is up to date you should set Formtastic.
|
75
98
|
|
@@ -77,18 +100,24 @@ In order to use a Formtastic compatible template to hook into your custom form s
|
|
77
100
|
|
78
101
|
In order to use a SimpleForm compatible template to hook into your custom form styles configure `config/initializers/contact_us.rb`:
|
79
102
|
|
80
|
-
|
103
|
+
```ruby
|
104
|
+
config.form_gem = 'simple_form'
|
105
|
+
```
|
81
106
|
|
82
107
|
## UPGRADING
|
83
108
|
|
84
109
|
When upgrading from 0.1.x to 0.2.x you should rerun the install generator to install the new settings, views, and locale updates:
|
85
110
|
|
86
|
-
|
111
|
+
```shell
|
112
|
+
bundle exec rake contact_us:install
|
113
|
+
```
|
87
114
|
|
88
115
|
Or you may run the generators for each specific component you would like to update, which is quite useful when upgrading during patch releases for example from 0.2.0 to 0.2.1:
|
89
116
|
|
90
|
-
|
91
|
-
|
117
|
+
```shell
|
118
|
+
bundle exec rake contact_us:copy_locales
|
119
|
+
bundle exec rake contact_us:copy_views
|
120
|
+
```
|
92
121
|
|
93
122
|
## USAGE
|
94
123
|
|
@@ -104,6 +133,18 @@ Simply copy the `spec/integration/contact_us_lint_spec.rb` file, and add it to y
|
|
104
133
|
|
105
134
|
Please report any bugs or feature requests to the Github issues page @ https://github.com/jdutil/contact_us/issues
|
106
135
|
|
136
|
+
## TESTING
|
137
|
+
|
138
|
+
In order to run the spec suite:
|
139
|
+
|
140
|
+
```shell
|
141
|
+
bundle exec rspec spec
|
142
|
+
```
|
143
|
+
|
144
|
+
## TODO
|
145
|
+
|
146
|
+
* Add new language translations.
|
147
|
+
|
107
148
|
## CONTRIBUTING
|
108
149
|
|
109
150
|
In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
|
@@ -121,8 +162,8 @@ Here are some ways *you* can contribute:
|
|
121
162
|
* by resolving [issues](https://github.com/jdutil/contact_us/issues)
|
122
163
|
* by reviewing patches
|
123
164
|
|
124
|
-
##
|
165
|
+
## Donating
|
125
166
|
|
126
|
-
|
167
|
+
Bitcoin donations may be sent to: 1Jz1rWG6HSWb6eBGgTyhANrkVxmzY4YPKS
|
127
168
|
|
128
|
-
Copyright (c) 2011 Jeff Dutil, released under the [MIT license](https://github.com/jdutil/contact_us/tree/master/MIT-LICENSE).
|
169
|
+
Copyright (c) 2011-2013 Jeff Dutil, released under the [MIT license](https://github.com/jdutil/contact_us/tree/master/MIT-LICENSE).
|
@@ -4,7 +4,7 @@ class ContactUs::ContactsController < ApplicationController
|
|
4
4
|
@contact = ContactUs::Contact.new(params[:contact_us_contact])
|
5
5
|
|
6
6
|
if @contact.save
|
7
|
-
redirect_to('/', :notice => t('contact_us.notices.success'))
|
7
|
+
redirect_to(ContactUs.success_redirect || '/', :notice => t('contact_us.notices.success'))
|
8
8
|
else
|
9
9
|
flash[:error] = t('contact_us.notices.error')
|
10
10
|
render_new_page
|
@@ -4,7 +4,7 @@ class ContactUs::Contact
|
|
4
4
|
|
5
5
|
attr_accessor :email, :message, :name, :subject
|
6
6
|
|
7
|
-
validates :email, :format => { :with =>
|
7
|
+
validates :email, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i },
|
8
8
|
:presence => true
|
9
9
|
validates :message, :presence => true
|
10
10
|
validates :name, :presence => {:if => Proc.new{ContactUs.require_name}}
|
@@ -23,7 +23,7 @@ class ContactUs::Contact
|
|
23
23
|
end
|
24
24
|
return false
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def persisted?
|
28
28
|
false
|
29
29
|
end
|
@@ -4,5 +4,5 @@
|
|
4
4
|
<%= f.input :email, :label => t('.email') %>
|
5
5
|
<%= f.input :subject, :label => t('.subject') if ContactUs.require_subject %>
|
6
6
|
<%= f.input :message, :as => :text, :label => t('.message') %>
|
7
|
-
<%= f.button :submit, :
|
7
|
+
<%= f.button :submit, :value => t('.submit'), :alt => t('.submit'), :id => 'contact_us_contact_submit', :title => t('.submit') %>
|
8
8
|
<% end %>
|
@@ -6,15 +6,15 @@ de:
|
|
6
6
|
contact_mailer:
|
7
7
|
contact_email:
|
8
8
|
sent_by_contact_form: "Gesendet durch das Kontaktformular. %{email}"
|
9
|
-
sent_by_name: "
|
10
|
-
subject: "
|
9
|
+
sent_by_name: "Nachricht von %{name} mit der E-Mail Adresse %{email}"
|
10
|
+
subject: "Nachricht von %{email}"
|
11
11
|
contacts:
|
12
12
|
new: &new
|
13
13
|
contact_us: "Kontaktiere Uns"
|
14
|
-
email: "
|
14
|
+
email: "E-Mail"
|
15
15
|
message: "Nachricht"
|
16
16
|
name: "Name"
|
17
|
-
subject: "
|
17
|
+
subject: "Betreff"
|
18
18
|
submit: "Abschicken"
|
19
19
|
new_formtastic:
|
20
20
|
<<: *new
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
pl:
|
5
|
+
contact_us:
|
6
|
+
contact_mailer:
|
7
|
+
contact_email:
|
8
|
+
sent_by_contact_form: "Wysłane przez formularz kontaktowy z %{email}"
|
9
|
+
sent_by_name: "Wysłane przez %{name} z %{email}"
|
10
|
+
subject: "Wiadomość od %{email}"
|
11
|
+
contacts:
|
12
|
+
new: &new
|
13
|
+
contact_us: "Kontakt z nami"
|
14
|
+
email: "Email"
|
15
|
+
message: "Wiadomość"
|
16
|
+
name: "Imię"
|
17
|
+
subject: "Temat"
|
18
|
+
submit: "Wyślij"
|
19
|
+
new_formtastic:
|
20
|
+
<<: *new
|
21
|
+
new_simple_form:
|
22
|
+
<<: *new
|
23
|
+
notices:
|
24
|
+
error: "Musisz wypełnić oba pola."
|
25
|
+
success: "Twój email został wysłany"
|
@@ -6,20 +6,20 @@ pt-BR:
|
|
6
6
|
contact_mailer:
|
7
7
|
contact_email:
|
8
8
|
sent_by_contact_form: "Enviado pelo formulário de contato. %{email}"
|
9
|
-
sent_by_name: "
|
10
|
-
subject: "
|
9
|
+
sent_by_name: "Enviado por %{name} de %{email}"
|
10
|
+
subject: "Contate-nos: nova mensagem de %{email}"
|
11
11
|
contacts:
|
12
12
|
new: &new
|
13
13
|
contact_us: "Contate-nos"
|
14
14
|
email: "Email"
|
15
|
-
message: "
|
16
|
-
name: "
|
17
|
-
subject: "
|
15
|
+
message: "Mensagem"
|
16
|
+
name: "Nome"
|
17
|
+
subject: "Assunto"
|
18
18
|
submit: "Enviar"
|
19
19
|
new_formtastic:
|
20
20
|
<<: *new
|
21
21
|
new_simple_form:
|
22
22
|
<<: *new
|
23
23
|
notices:
|
24
|
-
error: "Você
|
24
|
+
error: "Você tem de preencher ambos os campos."
|
25
25
|
success: "Email de contato foi enviado com sucesso."
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
pt-PT:
|
5
|
+
contact_us:
|
6
|
+
contact_mailer:
|
7
|
+
contact_email:
|
8
|
+
sent_by_contact_form: "Enviado pelo formulário de contacto. %{email}"
|
9
|
+
sent_by_name: "Enviado por %{name} de %{email}"
|
10
|
+
subject: "Contacte-nos: nova mensagem de %{email}"
|
11
|
+
contacts:
|
12
|
+
new: &new
|
13
|
+
contact_us: "Contacte-nos"
|
14
|
+
email: "Email"
|
15
|
+
message: "Mensagem"
|
16
|
+
name: "Nome"
|
17
|
+
subject: "Assunto"
|
18
|
+
submit: "Enviar"
|
19
|
+
new_formtastic:
|
20
|
+
<<: *new
|
21
|
+
new_simple_form:
|
22
|
+
<<: *new
|
23
|
+
notices:
|
24
|
+
error: "Tem de preencher ambos os campos."
|
25
|
+
success: "Email de contacto foi enviado com sucesso."
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
ru:
|
5
|
+
contact_us:
|
6
|
+
contact_mailer:
|
7
|
+
contact_email:
|
8
|
+
sent_by_contact_form: "Отправлено через контактную форму через %{email}"
|
9
|
+
sent_by_name: "Отправлено от %{name} через %{email}"
|
10
|
+
subject: "Контактное сообщение от %{email}"
|
11
|
+
contacts:
|
12
|
+
new: &new
|
13
|
+
contact_us: "Свяжитесь с Нами"
|
14
|
+
email: "Электронная Почта"
|
15
|
+
message: "Сообщение"
|
16
|
+
name: "Имя"
|
17
|
+
subject: "Тематика"
|
18
|
+
submit: "Отправить"
|
19
|
+
new_formtastic:
|
20
|
+
<<: *new
|
21
|
+
new_simple_form:
|
22
|
+
<<: *new
|
23
|
+
notices:
|
24
|
+
error: "Вы должны заполнить оба поля."
|
25
|
+
success: "Контактное сообщение отправлено."
|
data/config/routes.rb
CHANGED
data/contact_us.gemspec
CHANGED
@@ -12,18 +12,19 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{Gem providing simple Contact Us functionality with a Rails 3+ Engine.}
|
13
13
|
s.description = %q{A Rails 3+ Engine providing a basic contact form. I used Formtastic to keep things simple, and to hook into your apps custom Formtastic stylesheets.}
|
14
14
|
|
15
|
+
s.required_ruby_version = '>= 1.9.3'
|
15
16
|
s.rubyforge_project = "contact_us"
|
16
17
|
|
17
18
|
s.files = `git ls-files`.split("\n")
|
18
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
20
|
s.require_paths = ["lib"]
|
20
21
|
|
21
|
-
s.add_development_dependency "capybara",
|
22
|
-
s.add_development_dependency "rspec-rails",
|
23
|
-
s.add_development_dependency "shoulda-matchers", "
|
24
|
-
s.add_development_dependency "simplecov",
|
25
|
-
s.add_development_dependency "sqlite3",
|
26
|
-
s.add_development_dependency "formtastic",
|
22
|
+
s.add_development_dependency "capybara", "~> 2.0"
|
23
|
+
s.add_development_dependency "rspec-rails", "~> 2.13"
|
24
|
+
s.add_development_dependency "shoulda-matchers", ">= 1.5.4"
|
25
|
+
s.add_development_dependency "simplecov", "~> 0.7"
|
26
|
+
s.add_development_dependency "sqlite3", "~> 1.3.5"
|
27
|
+
s.add_development_dependency "formtastic", ">= 2.1.0"
|
27
28
|
s.add_development_dependency "simple_form"
|
28
29
|
|
29
30
|
s.add_runtime_dependency "rails", ">= 3.0.0"
|
data/lib/contact_us/version.rb
CHANGED
data/lib/contact_us.rb
CHANGED
@@ -16,6 +16,9 @@ module ContactUs
|
|
16
16
|
# Formtastic or SimpleForm
|
17
17
|
mattr_accessor :form_gem
|
18
18
|
|
19
|
+
# URL after a successful submission
|
20
|
+
mattr_accessor :success_redirect
|
21
|
+
|
19
22
|
# Default way to setup ContactUs. Run rake contact_us:install to create
|
20
23
|
# a fresh initializer with all configuration values.
|
21
24
|
def self.setup
|
data/lib/templates/contact_us.rb
CHANGED
@@ -21,7 +21,10 @@ ContactUs.setup do |config|
|
|
21
21
|
|
22
22
|
# Configure the form gem to use.
|
23
23
|
# Example:
|
24
|
-
# config.form_gem = 'formtastic
|
24
|
+
# config.form_gem = 'formtastic'
|
25
25
|
config.form_gem = nil
|
26
26
|
|
27
|
+
# Configure the redirect URL after a successful submission
|
28
|
+
config.success_redirect = '/'
|
29
|
+
|
27
30
|
end
|
@@ -4,13 +4,26 @@ describe ContactUs::ContactsController do
|
|
4
4
|
|
5
5
|
describe 'create' do
|
6
6
|
|
7
|
+
before do
|
8
|
+
ContactUs.mailer_to = 'test@example.com'
|
9
|
+
end
|
10
|
+
|
7
11
|
it 'should redirect with success message if valid contact' do
|
12
|
+
ContactUs.success_redirect = nil
|
8
13
|
post :create, :contact_us_contact => { :email => 'test@test.com', :message => 'test' }
|
9
14
|
assigns(:contact).valid?.should eql(true)
|
10
15
|
flash[:notice].should eql('Contact email was successfully sent.')
|
11
16
|
response.should redirect_to('/')
|
12
17
|
end
|
13
18
|
|
19
|
+
it 'should redirect to custom URL with success message if valid contact' do
|
20
|
+
ContactUs.success_redirect = '/success'
|
21
|
+
post :create, :contact_us_contact => { :email => 'test@test.com', :message => 'test' }
|
22
|
+
assigns(:contact).valid?.should eql(true)
|
23
|
+
flash[:notice].should eql('Contact email was successfully sent.')
|
24
|
+
response.should redirect_to('/success')
|
25
|
+
end
|
26
|
+
|
14
27
|
it 'should render new with error message if invalid contact' do
|
15
28
|
post :create, :contact_us_contact => { :email => 'test@test.com', :message => '' }
|
16
29
|
assigns(:contact).valid?.should eql(false)
|
File without changes
|
data/spec/lib/contact_us_spec.rb
CHANGED
metadata
CHANGED
@@ -1,68 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contact_us
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeff Dutil
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: capybara
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '2.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
26
|
+
version: '2.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec-rails
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: '2.
|
33
|
+
version: '2.13'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: '2.
|
40
|
+
version: '2.13'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: shoulda-matchers
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
47
|
+
version: 1.5.4
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
54
|
+
version: 1.5.4
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: simplecov
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: sqlite3
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,49 +83,43 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: formtastic
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: 2.1.0
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: 2.1.0
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: simple_form
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: rails
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: 3.0.0
|
134
118
|
type: :runtime
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - '>='
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: 3.0.0
|
142
125
|
description: A Rails 3+ Engine providing a basic contact form. I used Formtastic
|
@@ -149,9 +132,8 @@ extra_rdoc_files: []
|
|
149
132
|
files:
|
150
133
|
- .gitignore
|
151
134
|
- .rspec
|
152
|
-
- .rvmrc
|
153
135
|
- .travis.yml
|
154
|
-
- CHANGELOG
|
136
|
+
- CHANGELOG.md
|
155
137
|
- Gemfile
|
156
138
|
- MIT-LICENSE
|
157
139
|
- README.md
|
@@ -171,7 +153,10 @@ files:
|
|
171
153
|
- config/locales/contact_us.fr.yml
|
172
154
|
- config/locales/contact_us.it.yml
|
173
155
|
- config/locales/contact_us.ja.yml
|
156
|
+
- config/locales/contact_us.pl.yml
|
174
157
|
- config/locales/contact_us.pt-BR.yml
|
158
|
+
- config/locales/contact_us.pt-PT.yml
|
159
|
+
- config/locales/contact_us.ru.yml
|
175
160
|
- config/locales/contact_us.zh.yml
|
176
161
|
- config/routes.rb
|
177
162
|
- contact_us.gemspec
|
@@ -213,7 +198,7 @@ files:
|
|
213
198
|
- spec/dummy/public/javascripts/rails.js
|
214
199
|
- spec/dummy/public/stylesheets/.gitkeep
|
215
200
|
- spec/dummy/script/rails
|
216
|
-
- spec/
|
201
|
+
- spec/features/contact_us_lint_spec.rb
|
217
202
|
- spec/lib/contact_us_spec.rb
|
218
203
|
- spec/lib/install_spec.rb
|
219
204
|
- spec/mailers/contact_us/contact_mailer_spec.rb
|
@@ -222,27 +207,26 @@ files:
|
|
222
207
|
- spec/support/active_model_lint.rb
|
223
208
|
homepage: https://github.com/jdutil/contact_us
|
224
209
|
licenses: []
|
210
|
+
metadata: {}
|
225
211
|
post_install_message:
|
226
212
|
rdoc_options: []
|
227
213
|
require_paths:
|
228
214
|
- lib
|
229
215
|
required_ruby_version: !ruby/object:Gem::Requirement
|
230
|
-
none: false
|
231
216
|
requirements:
|
232
|
-
- -
|
217
|
+
- - '>='
|
233
218
|
- !ruby/object:Gem::Version
|
234
|
-
version:
|
219
|
+
version: 1.9.3
|
235
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
|
-
none: false
|
237
221
|
requirements:
|
238
|
-
- -
|
222
|
+
- - '>='
|
239
223
|
- !ruby/object:Gem::Version
|
240
224
|
version: '0'
|
241
225
|
requirements: []
|
242
226
|
rubyforge_project: contact_us
|
243
|
-
rubygems_version:
|
227
|
+
rubygems_version: 2.0.3
|
244
228
|
signing_key:
|
245
|
-
specification_version:
|
229
|
+
specification_version: 4
|
246
230
|
summary: Gem providing simple Contact Us functionality with a Rails 3+ Engine.
|
247
231
|
test_files:
|
248
232
|
- spec/controllers/contact_us/contact_controller_spec.rb
|
@@ -277,7 +261,7 @@ test_files:
|
|
277
261
|
- spec/dummy/public/javascripts/rails.js
|
278
262
|
- spec/dummy/public/stylesheets/.gitkeep
|
279
263
|
- spec/dummy/script/rails
|
280
|
-
- spec/
|
264
|
+
- spec/features/contact_us_lint_spec.rb
|
281
265
|
- spec/lib/contact_us_spec.rb
|
282
266
|
- spec/lib/install_spec.rb
|
283
267
|
- spec/mailers/contact_us/contact_mailer_spec.rb
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm 1.9.3-p125@contact_us
|