user_notif 0.1.13.1 → 0.1.13.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: f1a4e4c89d5a5afc0d1cea0a483fff48be37cc4a
4
- data.tar.gz: 069dafee28185bc0cfffeeae25a85378ba7313d8
3
+ metadata.gz: 4d89e77a8e5e36c93ab7a5eea1f84ac336f023ba
4
+ data.tar.gz: b531d67c47e7878841487a5c1224a643f3a77d57
5
5
  SHA512:
6
- metadata.gz: 0bf42a3cf05141091e68cf76c4e86660023f949619318b28e60ca3d6493af0cd52909b13cf0f1972614b9a703faf42b2b6d1d81ad9018be8335dc061b4b360f5
7
- data.tar.gz: 998d447f7b01f1d5b95e969088b90e3742cca564f449ffbbe2b6c4fbbe55fd34c7c9eddf3ea99af5fe727d5aa4d222425ebb14e252290d9ff66916733399c6b5
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
@@ -1,3 +1,3 @@
1
1
  module UserNotif
2
- VERSION = '0.1.13.1'
2
+ VERSION = '0.1.13.2'
3
3
  end
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.1
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-05-15 00:00:00.000000000 Z
11
+ date: 2016-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler