stonepath 0.4.3 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +2 -4
- data/Rakefile +3 -4
- data/VERSION +1 -1
- data/lib/generators/stonepath.rb +11 -0
- data/lib/generators/stonepath/event_log/event_log_generator.rb +34 -0
- data/{rails_generators/stonepath_event_log → lib/generators/stonepath/event_log}/templates/create_event_records.rb +0 -0
- data/{rails_generators/stonepath_event_log → lib/generators/stonepath/event_log}/templates/event_record.rb +0 -0
- data/lib/generators/stonepath/events_scaffold/events_scaffold_generator.rb +13 -0
- data/{rails_generators/stonepath_task → lib/generators/stonepath/task}/USAGE +0 -0
- data/lib/generators/stonepath/task/task_generator.rb +39 -0
- data/{rails_generators/stonepath_task/templates/generic_task_migration.rb → lib/generators/stonepath/task/templates/migration.rb} +4 -4
- data/{rails_generators/stonepath_task/templates/generic_task.rb → lib/generators/stonepath/task/templates/task.rb} +2 -2
- data/{rails_generators/stonepath_workitem → lib/generators/stonepath/workitem_model}/templates/migration.rb +4 -4
- data/lib/generators/stonepath/workitem_model/templates/model.rb +35 -0
- data/lib/generators/stonepath/workitem_model/workitem_model_generator.rb +36 -0
- data/{rails_generators/stonepath_workitem → lib/generators/stonepath/workitem_scaffold}/templates/model.rb +0 -0
- data/lib/generators/stonepath/workitem_scaffold/workitem_scaffold_generator.rb +13 -0
- data/lib/stonepath/work_item.rb +1 -3
- metadata +30 -52
- data/rails_generators/stonepath_event_log/stonepath_event_log_generator.rb +0 -9
- data/rails_generators/stonepath_task/stonepath_task_generator.rb +0 -29
- data/rails_generators/stonepath_workitem/USAGE +0 -51
- data/rails_generators/stonepath_workitem/stonepath_workitem_generator.rb +0 -196
- data/rails_generators/stonepath_workitem/templates/actions/create.rb +0 -9
- data/rails_generators/stonepath_workitem/templates/actions/destroy.rb +0 -6
- data/rails_generators/stonepath_workitem/templates/actions/edit.rb +0 -3
- data/rails_generators/stonepath_workitem/templates/actions/index.rb +0 -3
- data/rails_generators/stonepath_workitem/templates/actions/new.rb +0 -3
- data/rails_generators/stonepath_workitem/templates/actions/show.rb +0 -3
- data/rails_generators/stonepath_workitem/templates/actions/update.rb +0 -9
- data/rails_generators/stonepath_workitem/templates/controller.rb +0 -3
- data/rails_generators/stonepath_workitem/templates/event_controller.rb +0 -25
- data/rails_generators/stonepath_workitem/templates/fixtures.yml +0 -9
- data/rails_generators/stonepath_workitem/templates/helper.rb +0 -2
- data/rails_generators/stonepath_workitem/templates/tests/testunit/actions/create.rb +0 -11
- data/rails_generators/stonepath_workitem/templates/tests/testunit/actions/destroy.rb +0 -6
- data/rails_generators/stonepath_workitem/templates/tests/testunit/actions/edit.rb +0 -4
- data/rails_generators/stonepath_workitem/templates/tests/testunit/actions/index.rb +0 -4
- data/rails_generators/stonepath_workitem/templates/tests/testunit/actions/new.rb +0 -4
- data/rails_generators/stonepath_workitem/templates/tests/testunit/actions/show.rb +0 -4
- data/rails_generators/stonepath_workitem/templates/tests/testunit/actions/update.rb +0 -11
- data/rails_generators/stonepath_workitem/templates/tests/testunit/controller.rb +0 -5
- data/rails_generators/stonepath_workitem/templates/tests/testunit/model.rb +0 -7
- data/rails_generators/stonepath_workitem/templates/views/erb/_form.html.erb +0 -10
- data/rails_generators/stonepath_workitem/templates/views/erb/edit.html.erb +0 -12
- data/rails_generators/stonepath_workitem/templates/views/erb/index.html.erb +0 -27
- data/rails_generators/stonepath_workitem/templates/views/erb/new.html.erb +0 -5
- data/rails_generators/stonepath_workitem/templates/views/erb/show.html.erb +0 -26
data/README.rdoc
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
State-based workflow for rails.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
Update #2: Rather than reinvent a common wheel, StonePath now relies on the sentient_user gem.
|
|
5
|
+
As of verion 0.5.0, this supports Rails3. The only piece that needed to be upgrded was the generators, and with the new capabilities in rails3 generators, there will be a few new ones soon.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
The testing harness in this app is a Rails 2.3.8 app. Upgrading these tests is going to be painful, but will happen over the next few weeks.
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
gem install stonepath
|
|
12
10
|
|
|
13
11
|
== LICENSE:
|
|
14
12
|
|
data/Rakefile
CHANGED
|
@@ -13,10 +13,9 @@ begin
|
|
|
13
13
|
gemspec.homepage = "http://github.com/bokmann/stonepath"
|
|
14
14
|
gemspec.description = "Stateful workflow modeling for Rails"
|
|
15
15
|
gemspec.authors = ["David Bock"]
|
|
16
|
-
gemspec.add_dependency('activerecord','>=
|
|
17
|
-
gemspec.add_dependency('aasm','>= 2.
|
|
18
|
-
gemspec.add_dependency('sentient_user','>= 0.
|
|
19
|
-
|
|
16
|
+
gemspec.add_dependency('activerecord','>= 3.0.0')
|
|
17
|
+
gemspec.add_dependency('aasm','>= 2.2.0')
|
|
18
|
+
gemspec.add_dependency('sentient_user','>= 0.3.2')
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.5.0
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'rails/generators/named_base'
|
|
2
|
+
|
|
3
|
+
module Stonepath
|
|
4
|
+
module Generators
|
|
5
|
+
class Base < Rails::Generators::NamedBase
|
|
6
|
+
def self.source_root
|
|
7
|
+
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'stonepath', generator_name, 'templates'))
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'generators/stonepath'
|
|
2
|
+
|
|
3
|
+
module Stonepath
|
|
4
|
+
module Generators
|
|
5
|
+
class EventLogGenerator < Rails::Generators::Base
|
|
6
|
+
include Rails::Generators::Migration
|
|
7
|
+
|
|
8
|
+
def self.source_root
|
|
9
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create_model_file
|
|
13
|
+
template('event_record.rb', "app/models/event_record.rb")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create_migration
|
|
17
|
+
migration_template 'create_event_records.rb', "db/migrate/create_event_records.rb"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
# Implement the required interface for Rails::Generators::Migration.
|
|
23
|
+
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
|
24
|
+
def self.next_migration_number(dirname)
|
|
25
|
+
if ActiveRecord::Base.timestamped_migrations
|
|
26
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
27
|
+
else
|
|
28
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'generators/stonepath'
|
|
2
|
+
|
|
3
|
+
# it disgusts me how we generate the migration here. I would expect a better way in rails3.
|
|
4
|
+
#until I finf it, this technique is lifted from this blog entry
|
|
5
|
+
# http://www.themodestrubyist.com/2010/03/16/rails-3-plugins---part-3---rake-tasks-generators-initializers-oh-my/
|
|
6
|
+
module Stonepath
|
|
7
|
+
module Generators
|
|
8
|
+
class TaskGenerator < Base
|
|
9
|
+
include Rails::Generators::Migration
|
|
10
|
+
|
|
11
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
|
12
|
+
|
|
13
|
+
def create_model_file
|
|
14
|
+
template('task.rb', "app/models/#{file_name}.rb") if valid_model_name?(file_name)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create_migration
|
|
18
|
+
migration_template 'migration.rb', "db/migrate/create_#{file_name.pluralize}.rb"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
def valid_model_name?(name)
|
|
24
|
+
(name =~ /("|'|:|;|\||&|<|>)/).nil?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Implement the required interface for Rails::Generators::Migration.
|
|
28
|
+
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
|
29
|
+
def self.next_migration_number(dirname)
|
|
30
|
+
if ActiveRecord::Base.timestamped_migrations
|
|
31
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
32
|
+
else
|
|
33
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
class Create<%=
|
|
1
|
+
class Create<%= file_name.tableize.classify.pluralize %> < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
|
-
create_table :<%=
|
|
3
|
+
create_table :<%= file_name.tableize %> do |t|
|
|
4
4
|
|
|
5
5
|
# don't change these unless you want to get deep into meta in the
|
|
6
6
|
# stonepath gem.
|
|
@@ -13,7 +13,7 @@ class Create<%= args[0].tableize.classify.pluralize %> < ActiveRecord::Migration
|
|
|
13
13
|
t.timestamps
|
|
14
14
|
|
|
15
15
|
# This "urgent at' concept was useful in one of the domains StonePath
|
|
16
|
-
# was written/extracted from. The idea is
|
|
16
|
+
# was written/extracted from. The idea is that while something is 'due'
|
|
17
17
|
# at a specific time, it might become urgent shortly before it is due.
|
|
18
18
|
# In that domain, we color-coded tasks as green (due date is far out)
|
|
19
19
|
# yellow (urgent timestap has passed), and red (overdue - due date
|
|
@@ -31,6 +31,6 @@ class Create<%= args[0].tableize.classify.pluralize %> < ActiveRecord::Migration
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def self.down
|
|
34
|
-
drop_table :<%=
|
|
34
|
+
drop_table :<%= file_name.tableize %>
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class <%=
|
|
1
|
+
class <%= class_name %> < ActiveRecord::Base
|
|
2
2
|
include StonePath
|
|
3
3
|
|
|
4
4
|
stonepath_task
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
#log_events # uncomment this if you generate the event log.
|
|
7
7
|
|
|
8
8
|
attr_accessible :workitem, :workbench, <%= attributes.map { |a| ":#{a.name}" }.join(", ") %>
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
class Create<%=
|
|
1
|
+
class Create<%= file_name.tableize.classify.pluralize %> < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
|
-
create_table :<%=
|
|
3
|
+
create_table :<%= file_name.tableize %> do |t|
|
|
4
4
|
# These are the attributes of a workitem
|
|
5
5
|
t.string :aasm_state
|
|
6
6
|
t.integer :owner_id
|
|
@@ -19,6 +19,6 @@ class Create<%= plural_class_name %> < ActiveRecord::Migration
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def self.down
|
|
22
|
-
drop_table :<%=
|
|
22
|
+
drop_table :<%= file_name.tableize %>
|
|
23
23
|
end
|
|
24
|
-
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class <%= class_name %> < ActiveRecord::Base
|
|
2
|
+
include StonePath
|
|
3
|
+
|
|
4
|
+
stonepath_workitem do
|
|
5
|
+
#owned_by :your_owning class
|
|
6
|
+
|
|
7
|
+
#tasked_through :your_implementation_of_stonepath_task
|
|
8
|
+
|
|
9
|
+
#log_events # uncomment this if you generate the event log.
|
|
10
|
+
|
|
11
|
+
# This is an example trivial workflow. This is now yours to change as
|
|
12
|
+
# you see fit.
|
|
13
|
+
aasm_initial_state :pending
|
|
14
|
+
|
|
15
|
+
aasm_state :pending
|
|
16
|
+
aasm_state :in_process
|
|
17
|
+
aasm_state :completed
|
|
18
|
+
|
|
19
|
+
aasm_event :activate do
|
|
20
|
+
transitions :to => :in_process, :from => :pending
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
aasm_event :complete do
|
|
24
|
+
transitions :to => :completed, :from => :in_process
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
aasm_event :reactivate do
|
|
28
|
+
transitions :to => :in_process, :from => :completed
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
attr_accessible <%= attributes.map { |a| ":#{a.name}" }.join(", ") %>
|
|
34
|
+
|
|
35
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'generators/stonepath'
|
|
2
|
+
|
|
3
|
+
module Stonepath
|
|
4
|
+
module Generators
|
|
5
|
+
class WorkitemModelGenerator < Base
|
|
6
|
+
include Rails::Generators::Migration
|
|
7
|
+
|
|
8
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
|
9
|
+
|
|
10
|
+
def create_model_file
|
|
11
|
+
template('model.rb', "app/models/#{file_name}.rb") if valid_model_name?(file_name)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create_migration
|
|
15
|
+
migration_template 'migration.rb', "db/migrate/create_#{file_name.pluralize}.rb"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
protected
|
|
19
|
+
|
|
20
|
+
def valid_model_name?(name)
|
|
21
|
+
(name =~ /("|'|:|;|\||&|<|>)/).nil?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Implement the required interface for Rails::Generators::Migration.
|
|
25
|
+
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
|
26
|
+
def self.next_migration_number(dirname)
|
|
27
|
+
if ActiveRecord::Base.timestamped_migrations
|
|
28
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
29
|
+
else
|
|
30
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'generators/stonepath'
|
|
2
|
+
|
|
3
|
+
module Stonepath
|
|
4
|
+
module Generators
|
|
5
|
+
class WorkitemScaffoldGenerator < Base
|
|
6
|
+
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
|
7
|
+
|
|
8
|
+
def generate
|
|
9
|
+
puts "not yet implemented"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/stonepath/work_item.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stonepath
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 11
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 0.
|
|
8
|
+
- 5
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.5.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- David Bock
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-01-
|
|
18
|
+
date: 2011-01-24 00:00:00 -05:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -26,12 +26,12 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
hash:
|
|
29
|
+
hash: 7
|
|
30
30
|
segments:
|
|
31
|
-
-
|
|
31
|
+
- 3
|
|
32
32
|
- 0
|
|
33
33
|
- 0
|
|
34
|
-
version:
|
|
34
|
+
version: 3.0.0
|
|
35
35
|
type: :runtime
|
|
36
36
|
version_requirements: *id001
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
@@ -42,12 +42,12 @@ dependencies:
|
|
|
42
42
|
requirements:
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
hash:
|
|
45
|
+
hash: 7
|
|
46
46
|
segments:
|
|
47
47
|
- 2
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
version: 2.
|
|
48
|
+
- 2
|
|
49
|
+
- 0
|
|
50
|
+
version: 2.2.0
|
|
51
51
|
type: :runtime
|
|
52
52
|
version_requirements: *id002
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
@@ -58,12 +58,12 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
hash:
|
|
61
|
+
hash: 23
|
|
62
62
|
segments:
|
|
63
63
|
- 0
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
version: 0.
|
|
64
|
+
- 3
|
|
65
|
+
- 2
|
|
66
|
+
version: 0.3.2
|
|
67
67
|
type: :runtime
|
|
68
68
|
version_requirements: *id003
|
|
69
69
|
description: Stateful workflow modeling for Rails
|
|
@@ -81,6 +81,20 @@ files:
|
|
|
81
81
|
- README.rdoc
|
|
82
82
|
- Rakefile
|
|
83
83
|
- VERSION
|
|
84
|
+
- lib/generators/stonepath.rb
|
|
85
|
+
- lib/generators/stonepath/event_log/event_log_generator.rb
|
|
86
|
+
- lib/generators/stonepath/event_log/templates/create_event_records.rb
|
|
87
|
+
- lib/generators/stonepath/event_log/templates/event_record.rb
|
|
88
|
+
- lib/generators/stonepath/events_scaffold/events_scaffold_generator.rb
|
|
89
|
+
- lib/generators/stonepath/task/USAGE
|
|
90
|
+
- lib/generators/stonepath/task/task_generator.rb
|
|
91
|
+
- lib/generators/stonepath/task/templates/migration.rb
|
|
92
|
+
- lib/generators/stonepath/task/templates/task.rb
|
|
93
|
+
- lib/generators/stonepath/workitem_model/templates/migration.rb
|
|
94
|
+
- lib/generators/stonepath/workitem_model/templates/model.rb
|
|
95
|
+
- lib/generators/stonepath/workitem_model/workitem_model_generator.rb
|
|
96
|
+
- lib/generators/stonepath/workitem_scaffold/templates/model.rb
|
|
97
|
+
- lib/generators/stonepath/workitem_scaffold/workitem_scaffold_generator.rb
|
|
84
98
|
- lib/stonepath.rb
|
|
85
99
|
- lib/stonepath/config.rb
|
|
86
100
|
- lib/stonepath/dot.rb
|
|
@@ -93,42 +107,6 @@ files:
|
|
|
93
107
|
- lib/stonepath/work_owner.rb
|
|
94
108
|
- lib/tasks/stonepath.rake
|
|
95
109
|
- rails/init.rb
|
|
96
|
-
- rails_generators/stonepath_event_log/stonepath_event_log_generator.rb
|
|
97
|
-
- rails_generators/stonepath_event_log/templates/create_event_records.rb
|
|
98
|
-
- rails_generators/stonepath_event_log/templates/event_record.rb
|
|
99
|
-
- rails_generators/stonepath_task/USAGE
|
|
100
|
-
- rails_generators/stonepath_task/stonepath_task_generator.rb
|
|
101
|
-
- rails_generators/stonepath_task/templates/generic_task.rb
|
|
102
|
-
- rails_generators/stonepath_task/templates/generic_task_migration.rb
|
|
103
|
-
- rails_generators/stonepath_workitem/USAGE
|
|
104
|
-
- rails_generators/stonepath_workitem/stonepath_workitem_generator.rb
|
|
105
|
-
- rails_generators/stonepath_workitem/templates/actions/create.rb
|
|
106
|
-
- rails_generators/stonepath_workitem/templates/actions/destroy.rb
|
|
107
|
-
- rails_generators/stonepath_workitem/templates/actions/edit.rb
|
|
108
|
-
- rails_generators/stonepath_workitem/templates/actions/index.rb
|
|
109
|
-
- rails_generators/stonepath_workitem/templates/actions/new.rb
|
|
110
|
-
- rails_generators/stonepath_workitem/templates/actions/show.rb
|
|
111
|
-
- rails_generators/stonepath_workitem/templates/actions/update.rb
|
|
112
|
-
- rails_generators/stonepath_workitem/templates/controller.rb
|
|
113
|
-
- rails_generators/stonepath_workitem/templates/event_controller.rb
|
|
114
|
-
- rails_generators/stonepath_workitem/templates/fixtures.yml
|
|
115
|
-
- rails_generators/stonepath_workitem/templates/helper.rb
|
|
116
|
-
- rails_generators/stonepath_workitem/templates/migration.rb
|
|
117
|
-
- rails_generators/stonepath_workitem/templates/model.rb
|
|
118
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/actions/create.rb
|
|
119
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/actions/destroy.rb
|
|
120
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/actions/edit.rb
|
|
121
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/actions/index.rb
|
|
122
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/actions/new.rb
|
|
123
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/actions/show.rb
|
|
124
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/actions/update.rb
|
|
125
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/controller.rb
|
|
126
|
-
- rails_generators/stonepath_workitem/templates/tests/testunit/model.rb
|
|
127
|
-
- rails_generators/stonepath_workitem/templates/views/erb/_form.html.erb
|
|
128
|
-
- rails_generators/stonepath_workitem/templates/views/erb/edit.html.erb
|
|
129
|
-
- rails_generators/stonepath_workitem/templates/views/erb/index.html.erb
|
|
130
|
-
- rails_generators/stonepath_workitem/templates/views/erb/new.html.erb
|
|
131
|
-
- rails_generators/stonepath_workitem/templates/views/erb/show.html.erb
|
|
132
110
|
- script/console
|
|
133
111
|
- script/destroy
|
|
134
112
|
- script/generate
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
class StonepathEventLogGenerator < Rails::Generator::Base
|
|
2
|
-
def manifest
|
|
3
|
-
record do |m|
|
|
4
|
-
task_name = args[0]
|
|
5
|
-
m.template('event_record.rb', "app/models/event_record.rb")
|
|
6
|
-
m.migration_template("create_event_records.rb", "db/migrate", :migration_file_name => "create_event_records")
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
class StonepathTaskGenerator < Rails::Generator::Base
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
attr_accessor :name, :attributes
|
|
5
|
-
|
|
6
|
-
def initialize(runtime_args, runtime_options = {})
|
|
7
|
-
super
|
|
8
|
-
usage if @args.empty?
|
|
9
|
-
|
|
10
|
-
@name = @args.first
|
|
11
|
-
@controller_actions = []
|
|
12
|
-
@attributes = []
|
|
13
|
-
|
|
14
|
-
@args[1..-1].each do |arg|
|
|
15
|
-
if arg.include? ':'
|
|
16
|
-
@attributes << Rails::Generator::GeneratedAttribute.new(*arg.split(":"))
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
@attributes.uniq!
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def manifest
|
|
24
|
-
record do |m|
|
|
25
|
-
m.template('generic_task.rb', "app/models/#{@name.tableize.singularize}.rb")
|
|
26
|
-
m.migration_template("generic_task_migration.rb", "db/migrate", :migration_file_name => "create_#{@name.tableize}")
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
Description:
|
|
2
|
-
Scaffolds an entire resource, from model and migration to controller and
|
|
3
|
-
views. The resource is ready to use as a starting point for your restful,
|
|
4
|
-
resource-oriented application. Tests or specs are also generated depending
|
|
5
|
-
on if you have a "spec" directory or not.
|
|
6
|
-
|
|
7
|
-
IMPORTANT: This generator uses the "title" helper method which is generated
|
|
8
|
-
by the nifty_layout generator. You may want to run that generator first.
|
|
9
|
-
|
|
10
|
-
Usage:
|
|
11
|
-
Pass the name of the model, either CamelCased or under_scored, as the first
|
|
12
|
-
argument, and an optional list of attribute pairs and controller actions.
|
|
13
|
-
|
|
14
|
-
If no controller actions are specified, they will default to index, show,
|
|
15
|
-
new, create, edit, update, and destroy.
|
|
16
|
-
|
|
17
|
-
IMPORTANT: If no attribute pairs are specified, no model will be generated.
|
|
18
|
-
It will try to determine the attributes from an existing model.
|
|
19
|
-
|
|
20
|
-
Attribute pairs are column_name:sql_type arguments specifying the
|
|
21
|
-
model's attributes. Timestamps are added by default, so you don't have to
|
|
22
|
-
specify them by hand as 'created_at:datetime updated_at:datetime'.
|
|
23
|
-
|
|
24
|
-
For example, `nifty_scaffold post name:string content:text hidden:boolean`
|
|
25
|
-
gives you a model with those three attributes, a controller that handles
|
|
26
|
-
the create/show/update/destroy, forms to create and edit your posts, and
|
|
27
|
-
an index that lists them all, as well as a map.resources :posts
|
|
28
|
-
declaration in config/routes.rb.
|
|
29
|
-
|
|
30
|
-
Adding an "!" in the mix of arguments will invert the passed controller
|
|
31
|
-
actions. This will include all 7 controller actitons except the ones
|
|
32
|
-
mentioned. This option doesn't effect model attributes.
|
|
33
|
-
|
|
34
|
-
Examples:
|
|
35
|
-
script/generate nifty_scaffold post
|
|
36
|
-
|
|
37
|
-
Will create a controller called "posts" it will contain all seven
|
|
38
|
-
CRUD actions along with the views. A model will NOT be created,
|
|
39
|
-
instead it will look for an existing model and use those attributes.
|
|
40
|
-
|
|
41
|
-
script/generate nifty_scaffold post name:string content:text index new edit
|
|
42
|
-
|
|
43
|
-
Will create a Post model and migration file with the name and content
|
|
44
|
-
attributes. It will also create a controller with index, new, create,
|
|
45
|
-
edit, and update actions. Notice the create and update actions are
|
|
46
|
-
added automatically with new and edit.
|
|
47
|
-
|
|
48
|
-
script/generate nifty_scaffold post ! show new
|
|
49
|
-
|
|
50
|
-
Creates a posts controller (no model) with index, edit, update, and
|
|
51
|
-
destroy actions.
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
class StonepathWorkitemGenerator < Rails::Generator::Base
|
|
2
|
-
|
|
3
|
-
load File.expand_path( File.dirname(__FILE__)) + '/../../lib/stonepath/extensions/rails_generator_commands.rb'
|
|
4
|
-
|
|
5
|
-
attr_accessor :name, :attributes
|
|
6
|
-
|
|
7
|
-
def initialize(runtime_args, runtime_options = {})
|
|
8
|
-
super
|
|
9
|
-
usage if @args.empty?
|
|
10
|
-
|
|
11
|
-
@name = @args.first
|
|
12
|
-
@attributes = []
|
|
13
|
-
@args[1..-1].each do |arg|
|
|
14
|
-
if arg.include? ':'
|
|
15
|
-
@attributes << Rails::Generator::GeneratedAttribute.new(*arg.split(":"))
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
@attributes.uniq!
|
|
19
|
-
@controller_actions = all_actions
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def manifest
|
|
23
|
-
record do |m|
|
|
24
|
-
|
|
25
|
-
m.directory "app/models"
|
|
26
|
-
m.template "model.rb", "app/models/#{singular_name}.rb"
|
|
27
|
-
m.migration_template "migration.rb", "db/migrate", :migration_file_name => "create_#{plural_name}"
|
|
28
|
-
m.directory "test/unit"
|
|
29
|
-
m.template "tests/#{test_framework}/model.rb", "test/unit/#{singular_name}_test.rb"
|
|
30
|
-
m.directory "test/fixtures"
|
|
31
|
-
m.template "fixtures.yml", "test/fixtures/#{plural_name}.yml"
|
|
32
|
-
|
|
33
|
-
m.directory "app/controllers"
|
|
34
|
-
m.template "controller.rb", "app/controllers/#{plural_name}_controller.rb"
|
|
35
|
-
m.template "event_controller.rb", "app/controllers/#{singular_name}_events_controller.rb"
|
|
36
|
-
|
|
37
|
-
m.directory "app/helpers"
|
|
38
|
-
m.template "helper.rb", "app/helpers/#{plural_name}_helper.rb"
|
|
39
|
-
|
|
40
|
-
m.directory "app/views/#{plural_name}"
|
|
41
|
-
@controller_actions.each do |action|
|
|
42
|
-
if File.exist? source_path("views/#{view_language}/#{action}.html.#{view_language}")
|
|
43
|
-
m.template "views/#{view_language}/#{action}.html.#{view_language}", "app/views/#{plural_name}/#{action}.html.#{view_language}"
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
if form_partial?
|
|
48
|
-
m.template "views/#{view_language}/_form.html.#{view_language}", "app/views/#{plural_name}/_form.html.#{view_language}"
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
m.route_stonepath_workitems plural_name
|
|
52
|
-
|
|
53
|
-
m.directory "test/functional"
|
|
54
|
-
m.template "tests/#{test_framework}/controller.rb", "test/functional/#{plural_name}_controller_test.rb"
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def form_partial?
|
|
59
|
-
actions? :new, :edit
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def all_actions
|
|
63
|
-
%w[index show new create edit update destroy]
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def action?(name)
|
|
67
|
-
@controller_actions.include? name.to_s
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def actions?(*names)
|
|
71
|
-
names.all? { |n| action? n.to_s }
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def singular_name
|
|
75
|
-
name.underscore
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def plural_name
|
|
79
|
-
name.underscore.pluralize
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def class_name
|
|
83
|
-
name.camelize
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def object_id_name
|
|
87
|
-
(class_name.tableize.singularize + "_id")
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def plural_class_name
|
|
91
|
-
plural_name.camelize
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def controller_methods(dir_name)
|
|
95
|
-
@controller_actions.map do |action|
|
|
96
|
-
read_template("#{dir_name}/#{action}.rb")
|
|
97
|
-
end.join(" \n").strip
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def render_form
|
|
101
|
-
if form_partial?
|
|
102
|
-
if options[:haml]
|
|
103
|
-
"= render :partial => 'form'"
|
|
104
|
-
else
|
|
105
|
-
"<%= render :partial => 'form' %>"
|
|
106
|
-
end
|
|
107
|
-
else
|
|
108
|
-
read_template("views/#{view_language}/_form.html.#{view_language}")
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def items_path(suffix = 'path')
|
|
113
|
-
if action? :index
|
|
114
|
-
"#{plural_name}_#{suffix}"
|
|
115
|
-
else
|
|
116
|
-
"root_#{suffix}"
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def item_path(suffix = 'path')
|
|
121
|
-
if action? :show
|
|
122
|
-
"@#{singular_name}"
|
|
123
|
-
else
|
|
124
|
-
items_path(suffix)
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def item_path_for_spec(suffix = 'path')
|
|
129
|
-
if action? :show
|
|
130
|
-
"#{singular_name}_#{suffix}(assigns[:#{singular_name}])"
|
|
131
|
-
else
|
|
132
|
-
items_path(suffix)
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
def item_path_for_test(suffix = 'path')
|
|
137
|
-
if action? :show
|
|
138
|
-
"#{singular_name}_#{suffix}(assigns(:#{singular_name}))"
|
|
139
|
-
else
|
|
140
|
-
items_path(suffix)
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
def model_columns_for_attributes
|
|
145
|
-
class_name.constantize.columns.reject do |column|
|
|
146
|
-
column.name.to_s =~ /^(id|created_at|updated_at)$/
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
def rspec?
|
|
151
|
-
test_framework == :rspec
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
protected
|
|
155
|
-
|
|
156
|
-
def view_language
|
|
157
|
-
options[:haml] ? 'haml' : 'erb'
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def test_framework
|
|
161
|
-
options[:test_framework] ||= default_test_framework
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
def default_test_framework
|
|
165
|
-
File.exist?(destination_path("spec")) ? :rspec : :testunit
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
def add_options!(opt)
|
|
169
|
-
opt.separator ''
|
|
170
|
-
opt.separator 'Options:'
|
|
171
|
-
# opt.on("--skip-model", "Don't generate a model or migration file.") { |v| options[:skip_model] = v }
|
|
172
|
-
# opt.on("--skip-migration", "Don't generate migration file for model.") { |v| options[:skip_migration] = v }
|
|
173
|
-
# opt.on("--skip-timestamps", "Don't add timestamps to migration file.") { |v| options[:skip_timestamps] = v }
|
|
174
|
-
# opt.on("--skip-controller", "Don't generate controller, helper, or views.") { |v| options[:skip_controller] = v }
|
|
175
|
-
# opt.on("--invert", "Generate all controller actions except these mentioned.") { |v| options[:invert] = v }
|
|
176
|
-
# opt.on("--haml", "Generate HAML views instead of ERB.") { |v| options[:haml] = v }
|
|
177
|
-
# opt.on("--testunit", "Use test/unit for test files.") { options[:test_framework] = :testunit }
|
|
178
|
-
# opt.on("--rspec", "Use RSpec for test files.") { options[:test_framework] = :rspec }
|
|
179
|
-
# opt.on("--shoulda", "Use Shoulda for test files.") { options[:test_framework] = :shoulda }
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# is there a better way to do this? Perhaps with const_defined?
|
|
183
|
-
def model_exists?
|
|
184
|
-
File.exist? destination_path("app/models/#{singular_name}.rb")
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
def read_template(relative_path)
|
|
188
|
-
ERB.new(File.read(source_path(relative_path)), nil, '-').result(binding)
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
def banner
|
|
192
|
-
<<-EOS
|
|
193
|
-
Creates a WorkItem as defined by the Stonepath Workflow Methodology
|
|
194
|
-
EOS
|
|
195
|
-
end
|
|
196
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
def create
|
|
2
|
-
@<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
|
|
3
|
-
if @<%= singular_name %>.save
|
|
4
|
-
flash[:notice] = "Successfully created <%= name.underscore.humanize.downcase %>."
|
|
5
|
-
redirect_to <%= item_path('url') %>
|
|
6
|
-
else
|
|
7
|
-
render :action => 'new'
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
def update
|
|
2
|
-
@<%= singular_name %> = <%= class_name %>.find(params[:id])
|
|
3
|
-
if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
|
|
4
|
-
flash[:notice] = "Successfully updated <%= name.underscore.humanize.downcase %>."
|
|
5
|
-
redirect_to <%= item_path('url') %>
|
|
6
|
-
else
|
|
7
|
-
render :action => 'edit'
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# this is now your file to do with as you see fit. Before you modify it though, make sure you
|
|
2
|
-
# understand how the nested restful routes are defined in the routes.rb file!
|
|
3
|
-
|
|
4
|
-
class <%= class_name %>EventsController < ApplicationController
|
|
5
|
-
|
|
6
|
-
def create
|
|
7
|
-
if request.post?
|
|
8
|
-
@object = <%= class_name %>.find(params[:<%= object_id_name %>])
|
|
9
|
-
event = params[:id]
|
|
10
|
-
if <%= class_name %>.aasm_events.keys.include?(event.to_sym)
|
|
11
|
-
respond_to do |format|
|
|
12
|
-
if @object.send(event + "!")
|
|
13
|
-
flash[:notice] = "Event '#{event}' was successfully performed."
|
|
14
|
-
format.html { redirect_to(@object) }
|
|
15
|
-
format.xml { render :xml => @object }
|
|
16
|
-
else
|
|
17
|
-
flash[:notice] = "Event '#{event}' was NOT successfully performed."
|
|
18
|
-
format.html { redirect_to(@object) }
|
|
19
|
-
format.xml { render :xml => @object.errors, :status => :unprocessable_entity }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
def test_create_invalid
|
|
2
|
-
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
|
|
3
|
-
post :create
|
|
4
|
-
assert_template 'new'
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def test_create_valid
|
|
8
|
-
<%= class_name %>.any_instance.stubs(:valid?).returns(true)
|
|
9
|
-
post :create
|
|
10
|
-
assert_redirected_to <%= item_path_for_test('url') %>
|
|
11
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
def test_update_invalid
|
|
2
|
-
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
|
|
3
|
-
put :update, :id => <%= class_name %>.first
|
|
4
|
-
assert_template 'edit'
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def test_update_valid
|
|
8
|
-
<%= class_name %>.any_instance.stubs(:valid?).returns(true)
|
|
9
|
-
put :update, :id => <%= class_name %>.first
|
|
10
|
-
assert_redirected_to <%= item_path_for_test('url') %>
|
|
11
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<%% form_for @<%= singular_name %> do |f| %>
|
|
2
|
-
<%%= f.error_messages %>
|
|
3
|
-
<%- for attribute in attributes -%>
|
|
4
|
-
<p>
|
|
5
|
-
<%%= f.label :<%= attribute.name %> %><br />
|
|
6
|
-
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
|
|
7
|
-
</p>
|
|
8
|
-
<%- end -%>
|
|
9
|
-
<p><%%= f.submit "Submit" %></p>
|
|
10
|
-
<%% end %>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<%= render_form %>
|
|
2
|
-
|
|
3
|
-
<%- if actions? :show, :index -%>
|
|
4
|
-
<p>
|
|
5
|
-
<%- if action? :show -%>
|
|
6
|
-
<%%= link_to "Show", @<%= singular_name %> %> |
|
|
7
|
-
<%- end -%>
|
|
8
|
-
<%- if action? :index -%>
|
|
9
|
-
<%%= link_to "View All", <%= plural_name %>_path %>
|
|
10
|
-
<%- end -%>
|
|
11
|
-
</p>
|
|
12
|
-
<%- end -%>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<table>
|
|
2
|
-
<tr>
|
|
3
|
-
<%- for attribute in attributes -%>
|
|
4
|
-
<th><%= attribute.column.human_name.titleize %></th>
|
|
5
|
-
<%- end -%>
|
|
6
|
-
</tr>
|
|
7
|
-
<%% for <%= singular_name %> in @<%= plural_name %> %>
|
|
8
|
-
<tr>
|
|
9
|
-
<%- for attribute in attributes -%>
|
|
10
|
-
<td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
|
|
11
|
-
<%- end -%>
|
|
12
|
-
<%- if action? :show -%>
|
|
13
|
-
<td><%%= link_to "Show", <%= singular_name %> %></td>
|
|
14
|
-
<%- end -%>
|
|
15
|
-
<%- if action? :edit -%>
|
|
16
|
-
<td><%%= link_to "Edit", edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
|
|
17
|
-
<%- end -%>
|
|
18
|
-
<%- if action? :destroy -%>
|
|
19
|
-
<td><%%= link_to "Destroy", <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
|
|
20
|
-
<%- end -%>
|
|
21
|
-
</tr>
|
|
22
|
-
<%% end %>
|
|
23
|
-
</table>
|
|
24
|
-
|
|
25
|
-
<%- if action? :new -%>
|
|
26
|
-
<p><%%= link_to "New <%= singular_name.titleize %>", new_<%= singular_name %>_path %></p>
|
|
27
|
-
<%- end -%>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<%- for attribute in attributes -%>
|
|
2
|
-
<p>
|
|
3
|
-
<strong><%= attribute.column.human_name.titleize %>:</strong>
|
|
4
|
-
<%%=h @<%= singular_name %>.<%= attribute.name %> %>
|
|
5
|
-
</p>
|
|
6
|
-
<%- end -%>
|
|
7
|
-
|
|
8
|
-
<p>
|
|
9
|
-
<strong>Current state: </strong><%%= @<%= singular_name %>.aasm_state.humanize %>
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
|
-
<p>
|
|
13
|
-
<%% @<%= singular_name %>.aasm_events_for_current_state.each do |event| %>
|
|
14
|
-
<%%= link_to_stonepath_event(@<%= singular_name %>, event) %> |
|
|
15
|
-
<%% end %>
|
|
16
|
-
|
|
17
|
-
<%- if action? :edit -%>
|
|
18
|
-
<%%= link_to "Edit", edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
|
|
19
|
-
<%- end -%>
|
|
20
|
-
<%- if action? :destroy -%>
|
|
21
|
-
<%%= link_to "Destroy", @<%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %> |
|
|
22
|
-
<%- end -%>
|
|
23
|
-
<%- if action? :index -%>
|
|
24
|
-
<%%= link_to "View All", <%= plural_name %>_path %>
|
|
25
|
-
<%- end -%>
|
|
26
|
-
</p>
|