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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfcec0a4f6933ab518a363b20b740d4bb35e6647
4
- data.tar.gz: c26e6b3cc73199cccd49fb3ebc46139bd6e9dd5a
3
+ metadata.gz: fae6ed30aafe5b7714dedfb3bf300dcb8edc9bb9
4
+ data.tar.gz: c86e89b53e3fdf85056fa19a85cc31b0925e45ed
5
5
  SHA512:
6
- metadata.gz: 29c121f3fac5b36102e0557c4e4c144941828d937f93e3758195956847693f12ac7c6cecddb6c7984517aaf8acef89c16f97f4975630ce735a01cb2d82980f94
7
- data.tar.gz: 279d2b9c96672366d64e8875827a7e464ddaed34f56b91f72019ebf02d145ba689f099b8fa217ff072bf24861c58351f0c6d218c31288b06c82b28ae6322a97b
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
@@ -22,7 +22,7 @@ class window.NotificationDropdown
22
22
  render: =>
23
23
  @el.html(@template(@)).attr('tabindex', 0)
24
24
 
25
- @checkVisibility()
25
+ # @checkVisibility()
26
26
  @setEvents()
27
27
  @poll()
28
28
 
@@ -0,0 +1,2 @@
1
+ %a{ href: root_url }
2
+ #{event.user.try :to_s} #{pastize(event.verb)} a #{event.eventable_type.titleize}
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.9'
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'
@@ -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 double, [notification] }
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.9
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-06-24 00:00:00.000000000 Z
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