notifications 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +34 -1
- data/app/controllers/notifications/notifications_controller.rb +1 -1
- data/lib/notifications/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be1823e4494bd5d54476e7821c4ff4a788505de4
|
4
|
+
data.tar.gz: 79d89fd0981387d57bc8ea3ad95d684b06f97107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
|