eventifier 0.0.3 → 0.0.4
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/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eventifier (0.0.
|
4
|
+
eventifier (0.0.4)
|
5
5
|
actionmailer
|
6
6
|
actionmailer
|
7
7
|
activerecord
|
@@ -37,8 +37,8 @@ GEM
|
|
37
37
|
multi_json (~> 1.0)
|
38
38
|
arel (3.0.2)
|
39
39
|
bson (1.6.4)
|
40
|
-
bson_ext (1.6.
|
41
|
-
bson (~> 1.6.
|
40
|
+
bson_ext (1.6.4)
|
41
|
+
bson (~> 1.6.4)
|
42
42
|
builder (3.0.0)
|
43
43
|
database_cleaner (0.7.2)
|
44
44
|
diff-lcs (1.1.3)
|
@@ -46,12 +46,12 @@ GEM
|
|
46
46
|
fabrication (1.4.0)
|
47
47
|
hike (1.2.1)
|
48
48
|
i18n (0.6.0)
|
49
|
-
journey (1.0.
|
49
|
+
journey (1.0.4)
|
50
50
|
mail (2.4.4)
|
51
51
|
i18n (>= 0.4.0)
|
52
52
|
mime-types (~> 1.16)
|
53
53
|
treetop (~> 1.4.8)
|
54
|
-
mime-types (1.
|
54
|
+
mime-types (1.19)
|
55
55
|
mongo (1.6.2)
|
56
56
|
bson (~> 1.6.2)
|
57
57
|
mongoid (2.4.11)
|
@@ -7,11 +7,7 @@ module Eventifier
|
|
7
7
|
|
8
8
|
def notification_email(notification)
|
9
9
|
@notification = notification
|
10
|
-
@notification_url =
|
11
|
-
main_app.url_for Eventifier::EventTracking.url_mappings[notification.event.eventable_type.underscore.to_sym].call(notification.event.eventable)
|
12
|
-
else
|
13
|
-
main_app.url_for notification.event.eventable
|
14
|
-
end
|
10
|
+
@notification_url = main_app.url_for notification.url
|
15
11
|
@notification_message = notification_message(notification.event)
|
16
12
|
|
17
13
|
mail :to => notification.user.email,
|
@@ -30,6 +30,14 @@ module Eventifier
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def url
|
34
|
+
if Eventifier::EventTracking.url_mappings[event.eventable_type.underscore.to_sym]
|
35
|
+
Eventifier::EventTracking.url_mappings[event.eventable_type.underscore.to_sym].call(event.eventable)
|
36
|
+
else
|
37
|
+
event.eventable
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
33
41
|
def unread_for?(user)
|
34
42
|
return true if user.notifications_last_read_at.nil?
|
35
43
|
created_at > user.notifications_last_read_at
|
data/lib/eventifier/version.rb
CHANGED
@@ -76,17 +76,17 @@ describe Eventifier do
|
|
76
76
|
|
77
77
|
it "should return the I18n message for that event" do
|
78
78
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :create)
|
79
|
-
helper.event_message(event).should == "<strong>#{event.user.name}</strong> just created a new post - you should check it out"
|
79
|
+
helper.event_message(event).should == "<strong class='user'>#{event.user.name}</strong> just created a new post - you should check it out"
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should return a message specific to a single change if only 1 change has been made" do
|
83
83
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :update, :change_data => { :name => ["Fred", "Mike"] })
|
84
|
-
helper.event_message(event).should == "<strong>#{event.user.name}</strong> made a change to their post"
|
84
|
+
helper.event_message(event).should == "<strong class='user'>#{event.user.name}</strong> made a change to their post"
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should return a message specific to multiple changes if more than 1 change has been made" do
|
88
88
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :update, :change_data => { :name => ["Fred", "Mike"], :age => [55, 65] })
|
89
|
-
helper.event_message(event).should == "<strong>#{event.user.name}</strong> made some changes to their post"
|
89
|
+
helper.event_message(event).should == "<strong class='user'>#{event.user.name}</strong> made some changes to their post"
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should return the default I18n message if one doesn't exist" do
|
@@ -100,7 +100,7 @@ describe Eventifier do
|
|
100
100
|
I18n.backend.store_translations :test, :events => @event_strings
|
101
101
|
I18n.with_locale("test") do
|
102
102
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :create)
|
103
|
-
helper.event_message(event).should == "<strong>#{event.user.name}</strong> created a <strong>Post</strong>"
|
103
|
+
helper.event_message(event).should == "<strong class='user'>#{event.user.name}</strong> created a <strong>Post</strong>"
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
@@ -30,21 +30,21 @@ describe Eventifier::NotificationHelper do
|
|
30
30
|
it "should return the I18n message for that event" do
|
31
31
|
|
32
32
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :create)
|
33
|
-
helper.notification_message(event).should == "<strong>#{event.user.name}</strong> just created an Post - you should check it out"
|
33
|
+
helper.notification_message(event).should == "<strong class='user'>#{event.user.name}</strong> just created an Post - you should check it out"
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should return a message specific to a single change if only 1 change has been made" do
|
37
37
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :update, :change_data => { :name => ["Fred", "Mike"] })
|
38
|
-
helper.notification_message(event).should == "<strong>#{event.user.name}</strong> made a change to their Post"
|
38
|
+
helper.notification_message(event).should == "<strong class='user'>#{event.user.name}</strong> made a change to their Post"
|
39
39
|
end
|
40
40
|
it "should return a message specific to a particular field change if configuration is present" do
|
41
41
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :update, :change_data => { :deleted_at => [nil, Time.now] })
|
42
|
-
helper.notification_message(event).should == "<strong>#{event.user.name}</strong> deleted their Post"
|
42
|
+
helper.notification_message(event).should == "<strong class='user'>#{event.user.name}</strong> deleted their Post"
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should return a message specific to multiple changes if more than 1 change has been made" do
|
46
46
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :update, :change_data => { :name => ["Fred", "Mike"], :age => [55, 65] })
|
47
|
-
helper.notification_message(event).should == "<strong>#{event.user.name}</strong> made some changes to their Post"
|
47
|
+
helper.notification_message(event).should == "<strong class='user'>#{event.user.name}</strong> made some changes to their Post"
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should return the default I18n message if one doesn't exist" do
|
@@ -58,7 +58,7 @@ describe Eventifier::NotificationHelper do
|
|
58
58
|
I18n.backend.store_translations :test, :notifications => @notification_strings
|
59
59
|
I18n.with_locale("test") do
|
60
60
|
event = Fabricate(:event, :eventable => Fabricate(:post), :verb => :create)
|
61
|
-
helper.notification_message(event).should == "<strong>#{event.user.name}</strong> created a <strong>Post</strong>"
|
61
|
+
helper.notification_message(event).should == "<strong class='user'>#{event.user.name}</strong> created a <strong>Post</strong>"
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-08-16 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
17
|
-
requirement: &
|
17
|
+
requirement: &70264499466000 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70264499466000
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: mongoid
|
28
|
-
requirement: &
|
28
|
+
requirement: &70264499465580 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70264499465580
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: actionmailer
|
39
|
-
requirement: &
|
39
|
+
requirement: &70264499465160 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70264499465160
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: fabrication
|
50
|
-
requirement: &
|
50
|
+
requirement: &70264499464720 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70264499464720
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: database_cleaner
|
61
|
-
requirement: &
|
61
|
+
requirement: &70264499464260 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70264499464260
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: pg
|
72
|
-
requirement: &
|
72
|
+
requirement: &70264499489580 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70264499489580
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rspec
|
83
|
-
requirement: &
|
83
|
+
requirement: &70264499488880 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '0'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70264499488880
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: activerecord
|
94
|
-
requirement: &
|
94
|
+
requirement: &70264499487960 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *70264499487960
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: bson_ext
|
105
|
-
requirement: &
|
105
|
+
requirement: &70264499487320 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *70264499487320
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: mongoid
|
116
|
-
requirement: &
|
116
|
+
requirement: &70264499486680 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,10 +121,10 @@ dependencies:
|
|
121
121
|
version: '0'
|
122
122
|
type: :runtime
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *70264499486680
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: actionmailer
|
127
|
-
requirement: &
|
127
|
+
requirement: &70264499486000 !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
130
130
|
- - ! '>='
|
@@ -132,7 +132,7 @@ dependencies:
|
|
132
132
|
version: '0'
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
|
-
version_requirements: *
|
135
|
+
version_requirements: *70264499486000
|
136
136
|
description: Tracks and logs events and sends notifications of events on Active Record
|
137
137
|
models.
|
138
138
|
email:
|