contactify 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +26 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/contactify/application.js +15 -0
- data/app/assets/javascripts/contactify/contacts.js +2 -0
- data/app/assets/stylesheets/contactify/application.css +13 -0
- data/app/assets/stylesheets/contactify/contacts.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/contactify/application_controller.rb +4 -0
- data/app/controllers/contactify/contacts_controller.rb +109 -0
- data/app/helpers/contactify/application_helper.rb +4 -0
- data/app/helpers/contactify/contacts_helper.rb +4 -0
- data/app/models/contactify/contact.rb +7 -0
- data/app/views/contactify/contacts/_form.html.erb +37 -0
- data/app/views/contactify/contacts/edit.html.erb +6 -0
- data/app/views/contactify/contacts/index.html.erb +29 -0
- data/app/views/contactify/contacts/new.html.erb +5 -0
- data/app/views/contactify/contacts/new_public.html.erb +45 -0
- data/app/views/contactify/contacts/show.html.erb +25 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20130311025235_create_contactify_contacts.rb +12 -0
- data/lib/contactify.rb +4 -0
- data/lib/contactify/engine.rb +19 -0
- data/lib/contactify/version.rb +3 -0
- data/lib/generators/contactify/generate_views/generate_views_generator.rb +12 -0
- data/lib/generators/contactify/install/install_generator.rb +18 -0
- data/lib/generators/contactify/install/templates/contactify.yml +1 -0
- data/lib/generators/contactify/install/templates/recaptcha.rb +4 -0
- data/lib/tasks/contactify_tasks.rake +4 -0
- data/test/contactify_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/javascripts/welcome.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/welcome.css +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/welcome_controller.rb +4 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/welcome_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/welcome/index.html.erb +1 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +29 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/recaptcha.rb +4 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +7 -0
- data/test/dummy/db/schema.rb +25 -0
- data/test/dummy/log/development.log +8207 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/functional/welcome_controller_test.rb +9 -0
- data/test/dummy/test/unit/helpers/welcome_helper_test.rb +4 -0
- data/test/dummy/tmp/cache/assets/C47/D80/sprockets%2F6570303092ee142462efd3115952d3e6 +0 -0
- data/test/dummy/tmp/cache/assets/C7B/190/sprockets%2F37b103f4623089af1456b90830fe941c +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CE6/710/sprockets%2Fae161e57237d382658994f6aa36d2d0d +0 -0
- data/test/dummy/tmp/cache/assets/CEE/240/sprockets%2F9aa6e6be72c328f9717c5825db174690 +0 -0
- data/test/dummy/tmp/cache/assets/D06/1D0/sprockets%2F710eaa037fd91385d9f35bd510f1b454 +0 -0
- data/test/dummy/tmp/cache/assets/D13/C60/sprockets%2F2dedb8177c20286c4259c1d58c5646cc +0 -0
- data/test/dummy/tmp/cache/assets/D21/5D0/sprockets%2Fe2c4f946939f2d7d0b42d86383755cae +0 -0
- data/test/dummy/tmp/cache/assets/D23/960/sprockets%2Faef46413ffc04762e8c5b696997d2f33 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D3E/F40/sprockets%2F25a167c7563d6fe8ec6b13ec1ac09274 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D57/CB0/sprockets%2Fd08c623beb50800f7d0ba26cb7b0291e +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D60/9C0/sprockets%2F262b91312974aad8ca04fc2c8c535dca +0 -0
- data/test/dummy/tmp/cache/assets/D77/540/sprockets%2F66754f48cc6dc131855fcd8f2eca0a66 +0 -0
- data/test/dummy/tmp/cache/assets/D94/780/sprockets%2F1f410501d18b45beeb43fe88be2fc6e1 +0 -0
- data/test/dummy/tmp/cache/assets/DA0/140/sprockets%2F25f485eb0a9f28b68e69ab1c0f57c0da +0 -0
- data/test/dummy/tmp/cache/assets/DBA/BF0/sprockets%2Ffac675858fff51d567c52de6d981a9ae +0 -0
- data/test/dummy/tmp/cache/assets/DCF/BD0/sprockets%2Fc8b53c6aae12e5a5be5fe8db5472a793 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/E02/930/sprockets%2Fec83bf6c33e43fb6a5cf38a52df8c60e +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E2A/CE0/sprockets%2F17bd5e2fd8a5fd2d834c9dadfd102c2f +0 -0
- data/test/fixtures/contactify/contacts.yml +13 -0
- data/test/functional/contactify/contacts_controller_test.rb +51 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/contactify/contact_test.rb +9 -0
- data/test/unit/helpers/contactify/contacts_helper_test.rb +6 -0
- metadata +267 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MmQzZjMxOGIwNWEzYmEwNGQ0OWVlZTE5NmEzZGZjMmE0MGI2ZGY4OA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NGIxNWU1ZGVmNjI2MzczYzY4YjA2M2Q2NTkwYjM3NTg1MGFmNGMzMA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZmQ5NTgzM2YwOGZiNTkxNTMyMDI0MWU4MTNmMzgxMDI4ZjI3MGMwOTgwYmJh
|
10
|
+
MmFlYjViNTZkMTI3YTQwZDA2ZjI2YjBlMTk2Mjc5NDdmZWI5NTU4ODBkMTMw
|
11
|
+
MjA0OGIwOGU2ZTA2ZTgwNmZlMDc4Y2VlZTBkNmMyMGNjMmYyMTA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjQwMTM5ZmM4MGI1ODIzMDE1MDc4NmU4M2JiYmMxNjkxMTQ2NjYwZGRjNjM5
|
14
|
+
ZjkyMDdlODgzZmQ0ZTFlMzhjODZkMzM2MTRjNDk0MTcxNjdjMjRjZTk1OTU4
|
15
|
+
MGVlMDI3NThhMmFmYzMzMGM5YjQ0MzJkZTgyYjEzYjkwYWRkMjk=
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
= Contactify
|
2
|
+
|
3
|
+
Manage your contacts with reCaptcha.
|
4
|
+
|
5
|
+
Builds the form to get contacts on your site using reCaptcha and the Rails resources for managing your contacts.
|
6
|
+
|
7
|
+
|
8
|
+
== Installation
|
9
|
+
|
10
|
+
1. Add to your Gemfile: <tt>gem 'contactify'</tt>
|
11
|
+
|
12
|
+
2. Run <tt>bundle</tt>
|
13
|
+
|
14
|
+
3. Execute: <tt>rails generate contactify:install</tt>
|
15
|
+
|
16
|
+
4. Run migrations: <tt>rake db:migrate</tt>
|
17
|
+
|
18
|
+
5. Get your keys: http://www.google.com/recaptcha
|
19
|
+
|
20
|
+
6. Add your keys to: <tt>your_project/config/initializers/recaptcha.rb</tt>
|
21
|
+
|
22
|
+
7. Add to your routes.rb: <tt>mount Contactify::Engine => "/contactify", :as => "contactify_engine"</tt>
|
23
|
+
|
24
|
+
8. Add the link to the Contact Page: <tt><%= link_to "New contact", contactify_engine.contact_us_path %></tt>
|
25
|
+
|
26
|
+
9. Add a link in your backend so you can manage your contacts: <tt><%= link_to "Contacts", contactify.contacts_path %></tt>
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Contactify'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module Contactify
|
2
|
+
class ContactsController < ApplicationController
|
3
|
+
# GET /contacts
|
4
|
+
# GET /contacts.json
|
5
|
+
def index
|
6
|
+
@contacts = Contact.all
|
7
|
+
|
8
|
+
respond_to do |format|
|
9
|
+
format.html # index.html.erb
|
10
|
+
format.json { render json: @contacts }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /contacts/1
|
15
|
+
# GET /contacts/1.json
|
16
|
+
def show
|
17
|
+
@contact = Contact.find(params[:id])
|
18
|
+
|
19
|
+
respond_to do |format|
|
20
|
+
format.html # show.html.erb
|
21
|
+
format.json { render json: @contact }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# GET /contacts/new
|
26
|
+
# GET /contacts/new.json
|
27
|
+
def new
|
28
|
+
@contact = Contact.new
|
29
|
+
|
30
|
+
respond_to do |format|
|
31
|
+
format.html # new.html.erb
|
32
|
+
format.json { render json: @contact }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# GET /contacts/1/edit
|
37
|
+
def edit
|
38
|
+
@contact = Contact.find(params[:id])
|
39
|
+
end
|
40
|
+
|
41
|
+
# POST /contacts
|
42
|
+
# POST /contacts.json
|
43
|
+
def create
|
44
|
+
@contact = Contact.new(params[:contact])
|
45
|
+
|
46
|
+
respond_to do |format|
|
47
|
+
if @contact.save
|
48
|
+
format.html { redirect_to @contact, notice: 'Contact was successfully created.' }
|
49
|
+
format.json { render json: @contact, status: :created, location: @contact }
|
50
|
+
else
|
51
|
+
format.html { render action: "new" }
|
52
|
+
format.json { render json: @contact.errors, status: :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /contacts/1
|
58
|
+
# PUT /contacts/1.json
|
59
|
+
def update
|
60
|
+
@contact = Contact.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @contact.update_attributes(params[:contact])
|
64
|
+
format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }
|
65
|
+
format.json { head :no_content }
|
66
|
+
else
|
67
|
+
format.html { render action: "edit" }
|
68
|
+
format.json { render json: @contact.errors, status: :unprocessable_entity }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# DELETE /contacts/1
|
74
|
+
# DELETE /contacts/1.json
|
75
|
+
def destroy
|
76
|
+
@contact = Contact.find(params[:id])
|
77
|
+
@contact.destroy
|
78
|
+
|
79
|
+
respond_to do |format|
|
80
|
+
format.html { redirect_to contacts_url }
|
81
|
+
format.json { head :no_content }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def new_public
|
86
|
+
@contact = Contact.new
|
87
|
+
|
88
|
+
respond_to do |format|
|
89
|
+
format.html # new.html.erb
|
90
|
+
format.json { render json: @contact }
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def save_public
|
95
|
+
@contact = Contact.new(params[:contact])
|
96
|
+
|
97
|
+
respond_to do |format|
|
98
|
+
if verify_recaptcha(:model => @contact, :message => "Oh! It's error with reCAPTCHA!") && @contact.save
|
99
|
+
format.html { redirect_to contact_us_path, notice: 'Thank you for contacting us.' }
|
100
|
+
format.json { render json: @contact, status: :created, location: @contact }
|
101
|
+
else
|
102
|
+
format.html { render action: "new_public" }
|
103
|
+
format.json { render json: @contact.errors, status: :unprocessable_entity }
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= form_for @contact do |f| %>
|
2
|
+
<% if @contact.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @contact.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :first_name %><br />
|
16
|
+
<%= f.text_field :first_name %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :last_name %><br />
|
21
|
+
<%= f.text_field :last_name %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="field">
|
25
|
+
<%= f.label :email %><br />
|
26
|
+
<%= f.text_field :email %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="field">
|
30
|
+
<%= f.label :comment %><br />
|
31
|
+
<%= f.text_area :comment %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="actions">
|
35
|
+
<%= f.submit %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h1>Listing contacts</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>First name</th>
|
6
|
+
<th>Last name</th>
|
7
|
+
<th>Email</th>
|
8
|
+
<th>Comment</th>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
<th></th>
|
12
|
+
</tr>
|
13
|
+
|
14
|
+
<% @contacts.each do |contact| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= contact.first_name %></td>
|
17
|
+
<td><%= contact.last_name %></td>
|
18
|
+
<td><%= contact.email %></td>
|
19
|
+
<td><%= contact.comment %></td>
|
20
|
+
<td><%= link_to 'Show', contact %></td>
|
21
|
+
<td><%= link_to 'Edit', edit_contact_path(contact) %></td>
|
22
|
+
<td><%= link_to 'Destroy', contact, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br />
|
28
|
+
|
29
|
+
<%= link_to 'New Contact', new_contact_path %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Enter your personal information</h1>
|
4
|
+
|
5
|
+
<%= form_for @contact, :url => contact_us_submit_path do |f| %>
|
6
|
+
<% if @contact.errors.any? %>
|
7
|
+
<div id="error_explanation">
|
8
|
+
<h2><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>
|
9
|
+
|
10
|
+
<ul>
|
11
|
+
<% @contact.errors.full_messages.each do |msg| %>
|
12
|
+
<li><%= msg %></li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :first_name %><br />
|
20
|
+
<%= f.text_field :first_name %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="field">
|
24
|
+
<%= f.label :last_name %><br />
|
25
|
+
<%= f.text_field :last_name %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="field">
|
29
|
+
<%= f.label :email %><br />
|
30
|
+
<%= f.text_field :email %>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="field">
|
34
|
+
<%= f.label :comment %><br />
|
35
|
+
<%= f.text_area :comment %>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="field">
|
39
|
+
<%= recaptcha_tags %>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div class="actions">
|
43
|
+
<%= f.submit %>
|
44
|
+
</div>
|
45
|
+
<% end %>
|