notifications 0.4.3 → 0.4.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.
- checksums.yaml +5 -5
- data/README.md +8 -8
- data/db/migrate/20160328045436_create_notifications.rb +1 -1
- data/lib/notifications/model.rb +1 -1
- data/lib/notifications/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 79db559c211b2011d5615a2ac349e6d36abf5ec76c61bb2fcb08db013d5ced50
|
4
|
+
data.tar.gz: cffba71597d27b35f00357c9a743645a9c276b673acc618214084110f0f46c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0998a62dd596d90afcdc6289d4a54195f00ad39c782ef31e503f4263cd94309c5ce1660651f48a6686bf50749449f71cda01b6902bd1a8d0a2c2224f211385eb'
|
7
|
+
data.tar.gz: 754e36beeb1b439e4acaa89f7c651e36f21f884cac0a628ba3b081691abe92e9c23bac0955b787e2d60be463efa586f454162c44a14bb346af5b854988b617da
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Notifications
|
2
2
|
|
3
|
-
|
3
|
+
Mountable notifications for any Rails applications.
|
4
4
|
|
5
5
|
[](https://badge.fury.io/rb/notifications) [](https://travis-ci.org/rails-engine/notifications) [](https://codeclimate.com/github/rails-engine/notifications) [](https://codecov.io/github/rails-engine/notifications?branch=master) [](http://inch-ci.org/github/rails-engine/notifications?branch=master)
|
6
6
|
|
@@ -17,13 +17,13 @@ gem 'notifications'
|
|
17
17
|
|
18
18
|
And then run `bundle install`.
|
19
19
|
|
20
|
-
|
20
|
+
You now have a notifications generator in your Rails application:
|
21
21
|
|
22
22
|
```bash
|
23
23
|
$ rails g notifications:install
|
24
24
|
```
|
25
25
|
|
26
|
-
|
26
|
+
You can generate views, controllers if you need to customize them:
|
27
27
|
|
28
28
|
```bash
|
29
29
|
$ rails g notifications:views
|
@@ -56,7 +56,7 @@ class Comment
|
|
56
56
|
end
|
57
57
|
```
|
58
58
|
|
59
|
-
Get
|
59
|
+
Get unread notifications count for a user:
|
60
60
|
|
61
61
|
```rb
|
62
62
|
count = Notification.unread_count(current_user)
|
@@ -64,7 +64,7 @@ count = Notification.unread_count(current_user)
|
|
64
64
|
|
65
65
|
### Write your custom Notification partial view for notify_types:
|
66
66
|
|
67
|
-
If you create a notify_type, you need add a partial view in `app/views/notifications/` path, for example:
|
67
|
+
If you create a notify_type, you need to add a partial view in `app/views/notifications/` path, for example:
|
68
68
|
|
69
69
|
```rb
|
70
70
|
# There have two notify_type
|
@@ -72,7 +72,7 @@ Notification.create(notify_type: 'follow' ....)
|
|
72
72
|
Notification.create(notify_type: 'mention', target: @reply, second_target: @topic, ....)
|
73
73
|
```
|
74
74
|
|
75
|
-
You app must
|
75
|
+
You app must have:
|
76
76
|
|
77
77
|
- app/views/notifications/_follow.html.erb
|
78
78
|
- app/views/notifications/_mention.html.erb
|
@@ -87,7 +87,7 @@ You app must be have:
|
|
87
87
|
```erb
|
88
88
|
# app/views/notifications/_mention.html.erb
|
89
89
|
<div class="media-heading">
|
90
|
-
<%= link_to notification.actor.title, notification.actor %> has
|
90
|
+
<%= link_to notification.actor.title, notification.actor %> has mentioned you in
|
91
91
|
<%= link_to notification.second_target.title, topic_path(notification.second_target) %>
|
92
92
|
</div>
|
93
93
|
<div class="media-content">
|
@@ -97,7 +97,7 @@ You app must be have:
|
|
97
97
|
|
98
98
|
### About Notification template N+1 performance
|
99
99
|
|
100
|
-
|
100
|
+
It is recommended that you use [second_level_cache](https://github.com/hooopo/second_level_cache) for solving N+1 performance issues.
|
101
101
|
|
102
102
|
## Contributing
|
103
103
|
|
data/lib/notifications/model.rb
CHANGED
@@ -5,7 +5,7 @@ module Notifications
|
|
5
5
|
DEFAULT_AVATAR = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAADwCAMAAAAJixmgAAAAFVBMVEWkpKSnp6eqqqq3t7fS0tLV1dXZ2dmshcKEAAAAtklEQVR4Ae3XsRGAAAjAQFRk/5HtqaTz5H+DlInvAQAAAAAAAAAAAAAAAAAAAACymiveO6o7BQsWLFiwYMGCBS8PFixYsGDBggULFixYsGDBggULFixYsGDBggULFixYsGDBc4IFCxYsWLBgwYIFC14ZfOeAPRQ8IliwYMGCBQsWLFiwYMGCBQsWLFiwYMGCBQsWLFiwYMGCBQsWLFiwYMGCBQv+JQAAAAAAAAAAAAAAAAAAAOAB4KJfdHmj+kwAAAAASUVORK5CYII='
|
6
6
|
|
7
7
|
included do
|
8
|
-
belongs_to :actor, class_name: Notifications.config.user_class
|
8
|
+
belongs_to :actor, class_name: Notifications.config.user_class, optional: true
|
9
9
|
belongs_to :user, class_name: Notifications.config.user_class
|
10
10
|
|
11
11
|
belongs_to :target, polymorphic: true, optional: true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.6
|
92
|
+
rubygems_version: 2.7.6
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Rails mountable Notification for any applications.
|