stonepath 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module StonePath
|
2
|
+
module EventLogging
|
3
|
+
|
4
|
+
def log_events
|
5
|
+
has_many :logged_events, :as => :auditable, :class_name => "EventRecord"
|
6
|
+
|
7
|
+
define_method :aasm_event_fired do |event_name, old_state_name, new_state_name|
|
8
|
+
current_user_id = current_user && current_user.id
|
9
|
+
self.logged_events.create(:event_name => event_name.to_s,
|
10
|
+
:old_state_name => old_state_name.to_s,
|
11
|
+
:new_state_name => new_state_name.to_s,
|
12
|
+
:user_id => current_user_id)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/stonepath/task.rb
CHANGED
@@ -44,6 +44,7 @@ module StonePath
|
|
44
44
|
|
45
45
|
def self.included(base)
|
46
46
|
base.instance_eval do
|
47
|
+
include AASM
|
47
48
|
|
48
49
|
# Tasks are now completely polymorphic between workbenches.
|
49
50
|
# as long as an activerecord model declares itself as a workbench and declares itself
|
@@ -55,17 +56,30 @@ module StonePath
|
|
55
56
|
# a workitem for the specific kind of task, everything just works.
|
56
57
|
belongs_to :workitem, :polymorphic => true
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
# module
|
62
|
-
end
|
63
|
-
|
64
|
-
include AASM
|
59
|
+
#add the ability to log events if the user so specifies
|
60
|
+
require File.expand_path(File.dirname(__FILE__)) + "/event_logging.rb"
|
61
|
+
extend StonePath::EventLogging
|
65
62
|
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
66
|
+
# I don't think this should really be part of Stonepath, but I'm adding it here as a comment
|
67
|
+
# to communicate some design intent to my fellow teammembers on a project using stonepath.
|
68
|
+
# For the 'timely|imminent|overdue' stuff, at the time the task is created, we would need to
|
69
|
+
# set and calculate the imminent_at and due_at times. These methods would then do what
|
70
|
+
# we need them to do.
|
71
|
+
# def imminent?
|
72
|
+
# return false if imminent_at.nil?
|
73
|
+
# imminent_at < Time.now
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# we might also want this method, which would be useful in css styling
|
77
|
+
# def timeliness
|
78
|
+
# return "overdue" if overdue?
|
79
|
+
# return "imminent" if imminent?
|
80
|
+
# return "timely"
|
81
|
+
# end
|
82
|
+
|
69
83
|
def overdue?
|
70
84
|
return false if due_at.nil?
|
71
85
|
due_at < Time.now
|
data/lib/stonepath/work_item.rb
CHANGED
@@ -8,19 +8,8 @@ module StonePath
|
|
8
8
|
base.instance_eval do
|
9
9
|
include AASM
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
has_many :logged_events, :as => :auditable, :class_name => "EventRecord"
|
14
|
-
|
15
|
-
define_method :aasm_event_fired do |event_name, old_state_name, new_state_name|
|
16
|
-
|
17
|
-
current_user_id = current_user && current_user.id
|
18
|
-
self.logged_events.create(:event_name => event_name.to_s,
|
19
|
-
:old_state_name => old_state_name.to_s,
|
20
|
-
:new_state_name => new_state_name.to_s,
|
21
|
-
:user_id => current_user_id)
|
22
|
-
end
|
23
|
-
end
|
11
|
+
require File.expand_path(File.dirname(__FILE__)) + "/event_logging.rb"
|
12
|
+
extend StonePath::EventLogging
|
24
13
|
|
25
14
|
def owned_by(owner, options={})
|
26
15
|
options.merge!(:class_name => owner.to_s.classify)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stonepath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Bock
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-05 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/stonepath/acl/state.rb
|
45
45
|
- lib/stonepath/config.rb
|
46
46
|
- lib/stonepath/controller_hooks.rb
|
47
|
+
- lib/stonepath/event_logging.rb
|
47
48
|
- lib/stonepath/extensions/activerecordbase.rb
|
48
49
|
- lib/stonepath/group.rb
|
49
50
|
- lib/stonepath/role.rb
|