user_notif 0.1.13.1 → 0.1.13.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 +11 -0
- data/lib/generators/user_notif/install_templates/create_notifs.rb +1 -0
- data/lib/user_notif/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d89e77a8e5e36c93ab7a5eea1f84ac336f023ba
|
4
|
+
data.tar.gz: b531d67c47e7878841487a5c1224a643f3a77d57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 875e68b2695a243be178f77258b06d6ffbe991402ea941dfccf6ee4a24ed9d929c7766bec2614dc80dcd491e42fd48e3a280d0e817ac592f426a037a15a3bf0c
|
7
|
+
data.tar.gz: 501521adc8b467ac8a5654e28e1e12914952f9842b99899114982c6c86638b85de6b743279a1286262d3bf3752dfa2e152a9012720b912c7be50b64a41cbd15e
|
data/README.md
CHANGED
@@ -74,6 +74,17 @@ It creates a NewFollowerNotif
|
|
74
74
|
|
75
75
|
Now you can add the logic to create notifications when a user is followed by another one (the target).
|
76
76
|
|
77
|
+
Example:
|
78
|
+
|
79
|
+
`NewProjectNotif.create(target: self, user: self.user)`
|
80
|
+
|
81
|
+
To create sticky notifs (notification staying on top of the list), you can add `sticky: true` when you create it. Like this:
|
82
|
+
|
83
|
+
`NewProjectNotif.create(target: self, user: self.user, sticky: true)`
|
84
|
+
|
85
|
+
Then, you can display it in your view like this: `<%= list_user_notifs(UserNotif::Notif.all.order(sticky: :desc, unread: desc, id: :desc)) %>`
|
86
|
+
This line of code will display notifications by sticky first, then unread, then by id.
|
87
|
+
|
77
88
|
### Views
|
78
89
|
|
79
90
|
To display your notifications, you can use some helpers:
|
@@ -3,6 +3,7 @@ class CreateNotifs < ActiveRecord::Migration
|
|
3
3
|
create_table :notifs do |t|
|
4
4
|
# Target is the object of the notification (like a Project, Donation or User)
|
5
5
|
t.references :target, polymorphic: true, index: true, null: false
|
6
|
+
t.boolean :sticky, default: false
|
6
7
|
t.belongs_to :user, index: true
|
7
8
|
t.boolean :unread, index: true, default: true
|
8
9
|
t.string :type
|
data/lib/user_notif/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_notif
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.13.
|
4
|
+
version: 0.1.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Terry Raimondo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|