notifications 0.0.1 → 0.0.2

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: da3d093b0b1103eaf30087ae164dffd0c081ab08
4
- data.tar.gz: f87db9bac406ca6547a5a24e7eb5580b3d4bc97f
3
+ metadata.gz: be1823e4494bd5d54476e7821c4ff4a788505de4
4
+ data.tar.gz: 79d89fd0981387d57bc8ea3ad95d684b06f97107
5
5
  SHA512:
6
- metadata.gz: b09f5e76bc019607928a8360810f4da6fbd3730aa29adf9dc9fb344d5ae9cbf120bc454bb803064c5ebd71fc947fadd28f834093e59190da8c246d803680b2e8
7
- data.tar.gz: d99136bd5ccd35afc9771beec8d342c75ba6423e53ebcffc5ef3456c8dfa0939f5fe7ad8d6476534277daa8f625e7a41d3fe9e6112da37fb4b72dca840681ee2
6
+ metadata.gz: 2f6047efb0067385f11a4c0ee4c090cdd2416b237cac94239eeecc180848085f06e2f34f0d79c27057354df95edd118dd66ce67e5ba1e758ba40440a81c16416
7
+ data.tar.gz: ab9b541e33c06c9e16678888f64964f30738e55f49bc01fb4f70e0a578f726b6ed5ed8873e470230c072731a1a58b04646850bc547f5de028e7f5a9357314791
data/README.md CHANGED
@@ -60,7 +60,40 @@ count = Notification.unread_count(current_user)
60
60
 
61
61
  ### Write your custom Notification partial view for notify_types:
62
62
 
63
- TODO...
63
+ If you create a notify_type, you need add a partial view in `app/views/notifications/` path, for example:
64
+
65
+ ```rb
66
+ # There have two notify_type
67
+ Notification.create(notify_type: 'follow' ....)
68
+ Notification.create(notify_type: 'mention', target: @reply, second_target: @topic, ....)
69
+ ```
70
+
71
+ You app must be have:
72
+
73
+ - app/views/notifications/_follow.html.erb
74
+ - app/views/notifications/_mention.html.erb
75
+
76
+ ```erb
77
+ # app/views/notifications/_follow.html.erb
78
+ <div class="media-heading">
79
+ <%= link_to notification.actor.title, notification.actor %> just followed you.
80
+ </div>
81
+ ```
82
+
83
+ ```erb
84
+ # app/views/notifications/_mention.html.erb
85
+ <div class="media-heading">
86
+ <%= link_to notification.actor.title, notification.actor %> has mention you in
87
+ <%= link_to notification.second_target.title, topic_path(notification.second_target) %>
88
+ </div>
89
+ <div class="media-content">
90
+ <%= notification.target.body %>
91
+ </div>
92
+ ```
93
+
94
+ ### About Notification template N+1 performance
95
+
96
+ We suggest use [second_level_cached](https://github.com/hooopo/second_level_cache) for solve N+1 performance issue.
64
97
 
65
98
  ### Mark notifications as read
66
99
 
@@ -7,7 +7,7 @@ module Notifications
7
7
  @notifications.each do |n|
8
8
  unread_ids << n.id unless n.read?
9
9
  end
10
- # Notification.read!(unread_ids)
10
+ Notification.read!(unread_ids)
11
11
  end
12
12
 
13
13
  def clean
@@ -1,3 +1,3 @@
1
1
  module Notifications
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifications
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee