resource_cloner 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +32 -0
- data/lib/generators/resource_clone/USAGE +8 -0
- data/lib/generators/resource_clone/resource_clone_generator.rb +139 -0
- data/lib/resource_cloner.rb +2 -0
- data/lib/resource_cloner/version.rb +3 -0
- data/lib/tasks/resource_cloner_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/people.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/assets/stylesheets/people.css +4 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/people_controller.rb +51 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/person.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/people/_form.html.haml +34 -0
- data/test/dummy/app/views/people/edit.html.haml +2 -0
- data/test/dummy/app/views/people/index.html.haml +53 -0
- data/test/dummy/app/views/people/new.html.haml +2 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -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 +82 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +90 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20140804165241_create_people.rb +13 -0
- data/test/dummy/db/migrate/20140811221226_create_zombies.rb +13 -0
- data/test/dummy/db/schema.rb +26 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +23 -0
- data/test/dummy/log/test.log +3490 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/controllers/people_controller_test.rb +39 -0
- data/test/dummy/test/fixtures/people.yml +15 -0
- data/test/dummy/test/helpers/people_helper_test.rb +4 -0
- data/test/dummy/test/models/person_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/14492c596885cafe7932045e4e7efd3f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/80684416a4e6815bdae5306d295b9024 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b84b903597039697e3e76b6178af6ab3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/dd863e40bd669f77bb549b257d88d6b5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/lib/generators/dummy_test_files/config/routes.rb +5 -0
- data/test/lib/generators/resource_clone_generator_test.rb +133 -0
- data/test/test_helper.rb +16 -0
- data/test/tmp/generators/config/routes.rb +5 -0
- metadata +225 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 30d522596705c7b477347de296c4811503a2bda5
|
4
|
+
data.tar.gz: 135a4c89c5490cabf6cc9a23864b7c1ca24fe3ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 54cd5ab820ef300f2d5b215033adb77a33c6677e9cc8d4bf94d16fb66b82425e76b60e2c739c7a5bacfb7e60d9e928391788e2bc0be73212d077165befac02bb
|
7
|
+
data.tar.gz: 865f1132832b8bc92c0d38fc13e4b7ab58b28deaaaa723a2fd7c92d3f6f28821c2420e05c27c72f4472dde131cd96bcb4a3c6824791d044b47d301eb87cd1316
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 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/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ResourceCloner'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
|
24
|
+
Rake::TestTask.new(:test) do |t|
|
25
|
+
t.libs << 'lib'
|
26
|
+
t.libs << 'test'
|
27
|
+
t.pattern = 'test/**/*_test.rb'
|
28
|
+
t.verbose = false
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1,139 @@
|
|
1
|
+
#rails g resource_clone cloned_person person
|
2
|
+
|
3
|
+
class ResourceCloneGenerator < Rails::Generators::NamedBase
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
#main argument is clone name
|
6
|
+
argument :source_model, type: :string, default: nil, banner: "source_model model"
|
7
|
+
class_option :test_mode, :type => :boolean, :default => false, :desc => "Skip db:migration"
|
8
|
+
check_class_collision # no suffix for model
|
9
|
+
check_class_collision suffix: "Controller"
|
10
|
+
#not sure it works for modules
|
11
|
+
check_class_collision suffix: "Helper"
|
12
|
+
check_class_collision suffix: "Test"
|
13
|
+
check_class_collision suffix: "Spec"
|
14
|
+
|
15
|
+
def check_for_model
|
16
|
+
begin
|
17
|
+
source_model.classify.constantize #throws runtime if model doesn't exist
|
18
|
+
rescue
|
19
|
+
raise Thor::Error,
|
20
|
+
"Cannot clone model (#{source_model}) that doesn't exist."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def handle_model
|
25
|
+
base_path = "app/models"
|
26
|
+
path = File.join(base_path, "#{file_name}.rb")
|
27
|
+
copy_file("#{Rails.root}/app/models/#{source_model}.rb", path)
|
28
|
+
gsub_file path, source_model.classify, class_name
|
29
|
+
#replace other uses of source_model here??? (should be using "self")
|
30
|
+
end
|
31
|
+
|
32
|
+
def handle_controller
|
33
|
+
base_path = "app/controllers"
|
34
|
+
path = File.join(base_path, "#{file_name.pluralize}_controller.rb")
|
35
|
+
copy_file("#{Rails.root}/app/controllers/#{source_model.pluralize}_controller.rb", path)
|
36
|
+
gsub_file path, source_model.classify.pluralize, class_name.pluralize
|
37
|
+
gsub_file path, source_model.classify, class_name
|
38
|
+
gsub_file path, "@#{source_model.pluralize} =", "@#{table_name} ="
|
39
|
+
gsub_file path, "@#{source_model} =", "@#{file_name} ="
|
40
|
+
gsub_file path, ":#{source_model}", ":#{file_name}"
|
41
|
+
gsub_file path, "def #{source_model}_params", "def #{file_name}_params"
|
42
|
+
end
|
43
|
+
|
44
|
+
def handle_views
|
45
|
+
base_path = "app/views/#{file_name.pluralize}"
|
46
|
+
directory "#{Rails.root}/app/views/#{source_model.pluralize}", base_path
|
47
|
+
gsub_file "#{base_path}/index.html.haml", "@#{source_model.pluralize}.", "@#{file_name.pluralize}."
|
48
|
+
gsub_file "#{base_path}/index.html.haml", %r((\s)#{source_model.humanize.pluralize}(\s)),
|
49
|
+
"+#{'\1'+file_name.humanize.pluralize+'\2'}"
|
50
|
+
gsub_file "#{base_path}/index.html.haml", %r(link_to (.*), edit_#{source_model}_path\(#{source_model}\)),
|
51
|
+
"link_to #{'\1'}, edit_#{file_name}_path(#{file_name})"
|
52
|
+
gsub_file "#{base_path}/index.html.haml", %r(link_to (.*), #{source_model}), "link_to #{'\1'}, #{file_name}"
|
53
|
+
gsub_file "#{base_path}/index.html.haml", %r(link_to (.*), new_#{source_model}_path),
|
54
|
+
"link_to #{'\1'}, new_#{file_name}_path"
|
55
|
+
gsub_file "#{base_path}/_form.html.haml", %r(@#{source_model}(\s)), "@#{file_name+'\1'}"
|
56
|
+
#TODO: DRY up
|
57
|
+
gsub_file "#{base_path}/edit.html.haml", %r(#{source_model.humanize}(\s)), "#{file_name.humanize+'\1'}"
|
58
|
+
gsub_file "#{base_path}/new.html.haml", %r(#{source_model.humanize}(\s)), "#{file_name.humanize+'\1'}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def handle_migration
|
62
|
+
migr_files = Dir["#{Rails.root}/db/migrate/*_create_#{source_model.pluralize}.rb"]
|
63
|
+
if migr_files.count > 0
|
64
|
+
@ts = Time.now.to_s(:number)
|
65
|
+
@new_migr_file = "#{@ts}_create_#{table_name}.rb"
|
66
|
+
copy_file migr_files.first, "db/migrate/#{@new_migr_file}"
|
67
|
+
gsub_file "db/migrate/#{@new_migr_file}",
|
68
|
+
"class Create#{source_model.classify.pluralize} < ActiveRecord::Migration",
|
69
|
+
"class Create#{table_name.classify.pluralize} < ActiveRecord::Migration"
|
70
|
+
gsub_file "db/migrate/#{@new_migr_file}", "create_table :#{source_model.pluralize} do |t|",
|
71
|
+
"create_table :#{table_name} do |t|"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def handle_routes
|
76
|
+
lines = File.readlines("#{Rails.root}/config/routes.rb")
|
77
|
+
|
78
|
+
#TODO: Make sure this works when multiple resources are defined on the same line
|
79
|
+
# ie. resources :photos, :books, :videos
|
80
|
+
rsrc_routes = lines.select { |line| line.match(%r(resources :#{source_model.pluralize})) }
|
81
|
+
routes_str = rsrc_routes.inject("") do |memo, route|
|
82
|
+
memo << route.gsub(%r(resources :#{source_model.pluralize}), "resources :#{table_name}")+"\n"
|
83
|
+
end
|
84
|
+
inject_into_file "config/routes.rb",
|
85
|
+
after: ".application.routes.draw do\n" do
|
86
|
+
routes_str
|
87
|
+
end
|
88
|
+
|
89
|
+
re = %r((\A\s*[get|post|put|patch|delete].*)#{source_model.pluralize}([/|#]))
|
90
|
+
method_routes = lines.select { |line| line.match(re) }
|
91
|
+
routes_str = method_routes.inject("") do |memo, route|
|
92
|
+
#memo << route.gsub(re, "#{'\1'+file_name.pluralize+'\2'}")
|
93
|
+
# above line didn't work for get '/people/:id' => 'people#show'
|
94
|
+
# so for now just replace old resource with new
|
95
|
+
memo << route.gsub(source_model.pluralize, file_name.pluralize)
|
96
|
+
end
|
97
|
+
inject_into_file "config/routes.rb",
|
98
|
+
after: ".application.routes.draw do\n" do
|
99
|
+
"\n"+routes_str
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def handle_tests
|
104
|
+
#???
|
105
|
+
end
|
106
|
+
|
107
|
+
def handle_assets
|
108
|
+
#???
|
109
|
+
end
|
110
|
+
|
111
|
+
def handle_messages
|
112
|
+
unless behavior == :revoke || options.test_mode?
|
113
|
+
msg = "\nRun new migration [#{@new_migr_file}] now "
|
114
|
+
msg += " by typing 'y' or type 'n' and run it later at your liesure."
|
115
|
+
if yes?(msg, :magenta)
|
116
|
+
rake "db:migrate:up VERSION=#{@ts}"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
########Resources items left to (possibly) clone########
|
125
|
+
|
126
|
+
# invoke test_unit
|
127
|
+
# create test/models/person_test.rb
|
128
|
+
# create test/fixtures/people.yml
|
129
|
+
#invoke test_unit
|
130
|
+
#create test/controllers/people_controller_test.rb
|
131
|
+
#invoke helper
|
132
|
+
#create app/helpers/people_helper.rb
|
133
|
+
#invoke test_unit
|
134
|
+
#create test/helpers/people_helper_test.rb
|
135
|
+
#invoke assets
|
136
|
+
#invoke js
|
137
|
+
#create app/assets/javascripts/people.js
|
138
|
+
#invoke css
|
139
|
+
#create app/assets/stylesheets/people.css
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
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
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
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 bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class PeopleController < ApplicationController
|
2
|
+
def index
|
3
|
+
setup_pagination
|
4
|
+
@people = Person.all
|
5
|
+
end
|
6
|
+
|
7
|
+
def new
|
8
|
+
@person = Person.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
@person = Person.new(person_params)
|
13
|
+
if @person.save
|
14
|
+
flash[:success] = "Created Person successfully"
|
15
|
+
redirect_to redir_url
|
16
|
+
else
|
17
|
+
flash[:error] = "Unable to create Person"
|
18
|
+
render :new
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def edit
|
23
|
+
@person = Person.find(params[:id])
|
24
|
+
end
|
25
|
+
|
26
|
+
def update
|
27
|
+
@person = Person.find(params[:id])
|
28
|
+
if @person.update_attributes(person_params)
|
29
|
+
flash[:success] = "Updated Person successfully"
|
30
|
+
redirect_to redir_url
|
31
|
+
else
|
32
|
+
flash[:error] = "Unable to update Person"
|
33
|
+
render :edit
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def destroy
|
38
|
+
@person = Person.find(params[:id])
|
39
|
+
if @person.destroy
|
40
|
+
flash[:success] = "Deleted Person successfully"
|
41
|
+
else
|
42
|
+
flash[:error] = "Unable to delete Person"
|
43
|
+
end
|
44
|
+
redirect_to people_url
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def person_params
|
49
|
+
params.required(:person).permit([])
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
=form_for @person do |f|
|
2
|
+
%table.outer
|
3
|
+
|
4
|
+
%tr
|
5
|
+
%td= f.label :first_name
|
6
|
+
%td.field= f.text_field :first_name
|
7
|
+
|
8
|
+
%tr
|
9
|
+
%td= f.label :last_name
|
10
|
+
%td.field= f.text_field :last_name
|
11
|
+
|
12
|
+
%tr
|
13
|
+
%td= f.label :email
|
14
|
+
%td.field= f.text_field :email
|
15
|
+
|
16
|
+
%tr
|
17
|
+
%td= f.label :title
|
18
|
+
%td.field= f.text_field :title
|
19
|
+
|
20
|
+
%tr
|
21
|
+
%td= f.label :dob
|
22
|
+
%td.field= f.datetime_select :dob
|
23
|
+
|
24
|
+
%tr
|
25
|
+
%td= f.label :is_manager
|
26
|
+
%td.field= f.check_box :is_manager
|
27
|
+
|
28
|
+
%tr
|
29
|
+
|
30
|
+
%td{:style => "text-align: center;"}
|
31
|
+
= f.submit "Save & Back to List", name: "btn_index"
|
32
|
+
|
33
|
+
%br/
|
34
|
+
= link_to "Back", people_path
|
@@ -0,0 +1,53 @@
|
|
1
|
+
%h4 Listing People
|
2
|
+
%table.outer-list#top-level
|
3
|
+
%thead
|
4
|
+
%tr.header-row{ style: "font-weight: bold;" }
|
5
|
+
|
6
|
+
%td First name
|
7
|
+
|
8
|
+
%td Last name
|
9
|
+
|
10
|
+
%td Email
|
11
|
+
|
12
|
+
%td Title
|
13
|
+
|
14
|
+
%td Dob
|
15
|
+
|
16
|
+
%td Is manager
|
17
|
+
|
18
|
+
|
19
|
+
%td.link_col
|
20
|
+
|
21
|
+
|
22
|
+
%td.link_col
|
23
|
+
|
24
|
+
%tbody.items
|
25
|
+
- @people.each do |person|
|
26
|
+
%tr.item
|
27
|
+
|
28
|
+
%td= person.first_name
|
29
|
+
|
30
|
+
%td= person.last_name
|
31
|
+
|
32
|
+
%td= person.email
|
33
|
+
|
34
|
+
%td= person.title
|
35
|
+
|
36
|
+
%td= person.dob
|
37
|
+
|
38
|
+
%td= person.is_manager
|
39
|
+
|
40
|
+
|
41
|
+
%td= link_to "Edit", edit_person_path(person)
|
42
|
+
|
43
|
+
|
44
|
+
%td= link_to "Del", person, method: :delete, data: {confirm: "Are you sure?"}
|
45
|
+
|
46
|
+
|
47
|
+
%tr#pagination-row
|
48
|
+
%td{:colspan => '8', :class => "pagination-container"}
|
49
|
+
= render partial: 'pagination', locals: { :coll => @people }
|
50
|
+
|
51
|
+
%br/
|
52
|
+
|
53
|
+
= link_to 'New Person', new_person_path
|