eventifier 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +20 -0
- data/app/assets/javascripts/eventifier/notifications.coffee +1 -1
- data/app/views/eventifier/dropdown/_notification.haml +2 -0
- data/eventifier.gemspec +2 -2
- data/lib/eventifier.rb +19 -0
- data/lib/eventifier/delivery.rb +7 -1
- data/spec/eventifier/delivery_spec.rb +10 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fae6ed30aafe5b7714dedfb3bf300dcb8edc9bb9
|
4
|
+
data.tar.gz: c86e89b53e3fdf85056fa19a85cc31b0925e45ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c5781bc59fbcf3ddb08c388ff6bb8a829bb0ce36190f5a8e4403ae9ba2c98a18eab2e983bb39afee29c7e8d3176027b4b511e42f1d5c2e843e676f27fd15b4
|
7
|
+
data.tar.gz: 98db09a201956715d8cd13fe7dd981f8a58811cc4cc8137ee5fb5649a366ea0dee2ab20841a137f25d18ae9542334c7a1527a375ca376d998a0c9142306f179c
|
data/README.textile
CHANGED
@@ -33,6 +33,17 @@ That's it!
|
|
33
33
|
|
34
34
|
h2. Installation
|
35
35
|
|
36
|
+
h4. Add Eventifier to your Gemfile
|
37
|
+
|
38
|
+
<pre><code>
|
39
|
+
# Gemfile
|
40
|
+
gem "eventifier"
|
41
|
+
</code></pre>
|
42
|
+
|
43
|
+
And run <code>bundle install</code>
|
44
|
+
|
45
|
+
h4. Add Eventifier to your Gemfile
|
46
|
+
|
36
47
|
<pre><code>
|
37
48
|
rails generate eventifier:install
|
38
49
|
rake eventifier:install:migrations
|
@@ -70,6 +81,15 @@ h4. Add the required routes
|
|
70
81
|
mount Eventifier::Engine => '/'
|
71
82
|
</code></pre>
|
72
83
|
|
84
|
+
h4. Customise views
|
85
|
+
|
86
|
+
<pre><code>
|
87
|
+
# app/views/eventifier/dropdown/_comment.haml
|
88
|
+
%a{ href: "#{root_url}#{url_for([object.commentable.user, object.commentable])}" }
|
89
|
+
= image_tag object.user.photo.thumb.url, class: 'avatar'
|
90
|
+
#{object.user.username} commented on your post
|
91
|
+
</code></pre>
|
92
|
+
|
73
93
|
h2. Sending of emails
|
74
94
|
|
75
95
|
You want to add a scheduled task to run the following task every x minutes
|
data/eventifier.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "eventifier"
|
4
|
-
s.version = '0.0.
|
5
|
-
s.authors = ["Nathan Sampimon", "Peter Murray"]
|
4
|
+
s.version = '0.0.10'
|
5
|
+
s.authors = ["Nathan Sampimon", "Peter Murray", "Pat Allan"]
|
6
6
|
s.email = ["nathan@inspire9.com"]
|
7
7
|
s.homepage = "http://github.com/inspire9/eventifier"
|
8
8
|
s.summary = "Event tracking and notifying for active record models"
|
data/lib/eventifier.rb
CHANGED
@@ -35,8 +35,27 @@ module Eventifier
|
|
35
35
|
def self.tracked_classes
|
36
36
|
@tracked_classes ||= []
|
37
37
|
end
|
38
|
+
|
39
|
+
def self.resume!
|
40
|
+
@suspended = false
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.suspend(&block)
|
44
|
+
suspend!
|
45
|
+
yield
|
46
|
+
resume!
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.suspend!
|
50
|
+
@suspended = true
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.suspended?
|
54
|
+
@suspended
|
55
|
+
end
|
38
56
|
end
|
39
57
|
|
58
|
+
|
40
59
|
require 'eventifier/tracker'
|
41
60
|
require 'eventifier/delivery'
|
42
61
|
require 'eventifier/event_tracking'
|
data/lib/eventifier/delivery.rb
CHANGED
@@ -11,7 +11,7 @@ class Eventifier::Delivery
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def deliver
|
14
|
-
if anything_to_send?
|
14
|
+
if anything_to_send? && user_receives_emails?
|
15
15
|
Eventifier.mailer.notifications(user, notifications_to_send).deliver
|
16
16
|
end
|
17
17
|
|
@@ -56,4 +56,10 @@ class Eventifier::Delivery
|
|
56
56
|
default = settings.preferences['email']['default']
|
57
57
|
default.nil? || default
|
58
58
|
end
|
59
|
+
|
60
|
+
def user_receives_emails?
|
61
|
+
return true unless user.respond_to? :eventifier_emails?
|
62
|
+
|
63
|
+
user.eventifier_emails?
|
64
|
+
end
|
59
65
|
end
|
@@ -2,7 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Eventifier::Delivery do
|
4
4
|
describe '#deliver' do
|
5
|
-
let(:delivery) { Eventifier::Delivery.new
|
5
|
+
let(:delivery) { Eventifier::Delivery.new user, [notification] }
|
6
|
+
let(:user) { double 'User' }
|
6
7
|
let(:notification) { double 'Notification', relations: [:subscribers], event: event, update_attribute: true }
|
7
8
|
let(:event) { double 'Event', verb: 'create',
|
8
9
|
eventable_type: 'Post' }
|
@@ -106,5 +107,13 @@ describe Eventifier::Delivery do
|
|
106
107
|
|
107
108
|
it_should_behave_like 'a blocked email'
|
108
109
|
end
|
110
|
+
|
111
|
+
context "user does not want eventifier emails" do
|
112
|
+
before :each do
|
113
|
+
user.stub eventifier_emails?: false
|
114
|
+
end
|
115
|
+
|
116
|
+
it_should_behave_like 'a blocked email'
|
117
|
+
end
|
109
118
|
end
|
110
119
|
end
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Sampimon
|
8
8
|
- Peter Murray
|
9
|
+
- Pat Allan
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: rails
|
@@ -210,6 +211,7 @@ files:
|
|
210
211
|
- app/models/eventifier/notification.rb
|
211
212
|
- app/models/eventifier/notification_setting.rb
|
212
213
|
- app/views/eventifier/_notification.haml
|
214
|
+
- app/views/eventifier/dropdown/_notification.haml
|
213
215
|
- app/views/eventifier/email/_notification.haml
|
214
216
|
- app/views/eventifier/mailer/notifications.haml
|
215
217
|
- app/views/eventifier/notifications/index.jbuilder
|