notification-renderer 1.2.6 → 2.0.0
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 +25 -63
- data/app/helpers/notification_renderer_helper.rb +1 -1
- data/lib/generators/notification_renderer/install_generator.rb +2 -1
- data/lib/notification-renderer.rb +3 -3
- data/lib/notification_renderer/configuration.rb +5 -2
- data/lib/notification_renderer/engine.rb +1 -1
- data/lib/notification_renderer/{notification_library.rb → notification_lib.rb} +1 -1
- metadata +75 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa29639e71ac1a9870c14071d6274bbd507de189a2c0ebac9a804d307577b510
|
4
|
+
data.tar.gz: 61c2c695bc2ad340a9ad7b2ecfd6bf3d966cc7c81af59d7b2de997dbe9617437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7865d41597d2d06299ee574f811212a2425533053cd2b9819d50612810ca11997225e66f11e8bb2f762024f94d852d8243224fd3eade3944ef2edc2e41b85d24
|
7
|
+
data.tar.gz: f4756a6497785dc4ee3e0964236d91429193cc03b4265d14f4d5c2c2f6e51543367276c626c1d27eded96c48b02dbfa5288892c7ac2f686df6795b87b768ff03
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# NotificationRenderer
|
2
2
|
|
3
|
-
[](https://badge.fury.io/rb/notification-renderer)
|
3
|
+
[](https://badge.fury.io/rb/notification-renderer) 
|
4
4
|
|
5
5
|
Render your notifications on multiple platforms by specifying notification types.
|
6
6
|
|
@@ -10,22 +10,20 @@ Render your notifications on multiple platforms by specifying notification types
|
|
10
10
|
|
11
11
|
* [Installation](#installation)
|
12
12
|
* [Usage](#usage)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
* [Types](#types)
|
14
|
+
* [Generating a new type](#generating-a-new-type)
|
15
|
+
* [Using a type](#using-a-type)
|
16
|
+
* [Renderers](#renderers)
|
17
|
+
* [View helpers](#view-helpers)
|
18
|
+
* [`render_notification`](#render_notification)
|
19
|
+
* [`render_notifications`](#render_notifications)
|
20
|
+
* [Grouping](#grouping)
|
21
|
+
* [Grouping by notification types](#grouping-by-notification-types)
|
22
|
+
* [Grouping by notification dates](#grouping-by-notification-dates)
|
23
23
|
* [Configuration](#configuration)
|
24
24
|
* [To Do](#to-do)
|
25
25
|
* [Contributing](#contributing)
|
26
|
-
|
27
|
-
* [Semantic versioning](#semantic-versioning)
|
28
|
-
* [License](#license)
|
26
|
+
* [Semantic versioning](#semantic-versioning)
|
29
27
|
|
30
28
|
---
|
31
29
|
|
@@ -45,12 +43,6 @@ Or install it yourself as:
|
|
45
43
|
|
46
44
|
$ gem install notification-renderer
|
47
45
|
|
48
|
-
If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
|
49
|
-
|
50
|
-
```ruby
|
51
|
-
gem 'notification-renderer', github: 'jonhue/notifications-rails'
|
52
|
-
```
|
53
|
-
|
54
46
|
Now run the generator:
|
55
47
|
|
56
48
|
$ rails g notification_renderer:install
|
@@ -78,9 +70,9 @@ This gem comes with a generator to make adding new types a whole lot easier. Run
|
|
78
70
|
This will create the following structure in your application:
|
79
71
|
|
80
72
|
* `views`
|
81
|
-
|
82
|
-
|
83
|
-
|
73
|
+
* `notifications`
|
74
|
+
* `notification`
|
75
|
+
* `_index.html.erb`
|
84
76
|
|
85
77
|
You can also customize the generated templates (renderers):
|
86
78
|
|
@@ -89,17 +81,17 @@ You can also customize the generated templates (renderers):
|
|
89
81
|
This command will also create a custom renderer called `feed` for the notification type `notification`:
|
90
82
|
|
91
83
|
* `views`
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
84
|
+
* `notifications`
|
85
|
+
* `notification`
|
86
|
+
* `_feed.html.erb`
|
87
|
+
* `_index.html.erb`
|
96
88
|
|
97
89
|
#### Using a type
|
98
90
|
|
99
91
|
You are able to specify the `type` of a `Notification` record:
|
100
92
|
|
101
93
|
```ruby
|
102
|
-
notification = Notification.create
|
94
|
+
notification = Notification.create(target: User.first, object: Recipe.first, type: 'notification')
|
103
95
|
```
|
104
96
|
|
105
97
|
**Note:** The `type` attribute of any new `Notification` record will default to the [`default_type` configuration](#configuration).
|
@@ -160,7 +152,7 @@ It wraps the rendered notifications in a `div`:
|
|
160
152
|
|
161
153
|
```html
|
162
154
|
<div class="notification-renderer notifications">
|
163
|
-
|
155
|
+
<!-- ... -->
|
164
156
|
</div>
|
165
157
|
```
|
166
158
|
|
@@ -206,9 +198,9 @@ This will render the last notification for every group and pass the attributes v
|
|
206
198
|
<!-- Renderer -->
|
207
199
|
|
208
200
|
<% if notification_grouped? %>
|
209
|
-
|
201
|
+
<%= notification.target.name %> and <%= (notifications.count - 1).to_s %> others commented on <%= attributes['object.article'].title %>.
|
210
202
|
<% else %>
|
211
|
-
|
203
|
+
<%= notification.target.name %> commented on <%= notification.object.article.title %>.
|
212
204
|
<% end %>
|
213
205
|
```
|
214
206
|
|
@@ -267,7 +259,7 @@ You can configure NotificationRenderer by passing a block to `configure`. This c
|
|
267
259
|
|
268
260
|
```ruby
|
269
261
|
NotificationRenderer.configure do |config|
|
270
|
-
|
262
|
+
config.default_type = 'notification'
|
271
263
|
end
|
272
264
|
```
|
273
265
|
|
@@ -281,7 +273,7 @@ end
|
|
281
273
|
|
282
274
|
## To Do
|
283
275
|
|
284
|
-
[
|
276
|
+
We use [GitHub projects](https://github.com/jonhue/notifications-rails/projects/7) to coordinate the work on this project.
|
285
277
|
|
286
278
|
To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/notifications-rails/issues/new).
|
287
279
|
|
@@ -293,36 +285,6 @@ We hope that you will consider contributing to NotificationRenderer. Please read
|
|
293
285
|
|
294
286
|
[Learn more about contributing to this repository](https://github.com/jonhue/notifications-rails/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/jonhue/notifications-rails/blob/master/CODE_OF_CONDUCT.md)
|
295
287
|
|
296
|
-
### Contributors
|
297
|
-
|
298
|
-
Give the people some :heart: who are working on this project. See them all at:
|
299
|
-
|
300
|
-
https://github.com/jonhue/notifications-rails/graphs/contributors
|
301
|
-
|
302
288
|
### Semantic Versioning
|
303
289
|
|
304
290
|
NotificationRenderer follows Semantic Versioning 2.0 as defined at http://semver.org.
|
305
|
-
|
306
|
-
## License
|
307
|
-
|
308
|
-
MIT License
|
309
|
-
|
310
|
-
Copyright (c) 2017 Jonas Hübotter
|
311
|
-
|
312
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
313
|
-
of this software and associated documentation files (the "Software"), to deal
|
314
|
-
in the Software without restriction, including without limitation the rights
|
315
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
316
|
-
copies of the Software, and to permit persons to whom the Software is
|
317
|
-
furnished to do so, subject to the following conditions:
|
318
|
-
|
319
|
-
The above copyright notice and this permission notice shall be included in all
|
320
|
-
copies or substantial portions of the Software.
|
321
|
-
|
322
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
323
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
324
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
325
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
326
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
327
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
328
|
-
SOFTWARE.
|
@@ -18,7 +18,7 @@ module NotificationRendererHelper
|
|
18
18
|
|
19
19
|
def render_notifications(notifications, renderer: default_renderer)
|
20
20
|
content_tag :div, class: 'notification-renderer notifications' do
|
21
|
-
notifications&.
|
21
|
+
notifications&.map do |notification|
|
22
22
|
render_notification(notification, renderer: renderer)
|
23
23
|
end
|
24
24
|
end
|
@@ -19,7 +19,7 @@ module NotificationRenderer
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def create_initializer
|
22
|
-
template 'initializer.rb', 'config/initializers/
|
22
|
+
template 'initializer.rb', 'config/initializers/notification_renderer.rb'
|
23
23
|
end
|
24
24
|
|
25
25
|
def create_notifications_migration_file
|
@@ -38,6 +38,7 @@ module NotificationRenderer
|
|
38
38
|
|
39
39
|
def migration_version
|
40
40
|
return unless Rails.version >= '5.0.0'
|
41
|
+
|
41
42
|
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
42
43
|
end
|
43
44
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module NotificationRenderer
|
4
|
-
|
4
|
+
require_relative 'notification_renderer/configuration'
|
5
5
|
|
6
|
-
|
6
|
+
require_relative 'notification_renderer/engine'
|
7
7
|
|
8
|
-
autoload :
|
8
|
+
autoload :NotificationLib, 'notification_renderer/notification_lib'
|
9
9
|
autoload :NotificationScopes, 'notification_renderer/notification_scopes'
|
10
10
|
end
|
@@ -2,11 +2,14 @@
|
|
2
2
|
|
3
3
|
module NotificationRenderer
|
4
4
|
class << self
|
5
|
-
|
5
|
+
attr_writer :configuration
|
6
|
+
|
7
|
+
def configuration
|
8
|
+
@configuration ||= Configuration.new
|
9
|
+
end
|
6
10
|
end
|
7
11
|
|
8
12
|
def self.configure
|
9
|
-
self.configuration ||= Configuration.new
|
10
13
|
yield configuration
|
11
14
|
end
|
12
15
|
|
metadata
CHANGED
@@ -1,73 +1,115 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notification-renderer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Hübotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '5.
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5.
|
40
|
+
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: notification-handler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: railties
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '5.
|
61
|
+
version: '5.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: factory_bot
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
98
|
+
name: rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-rails
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
115
|
- - ">="
|
@@ -108,6 +150,20 @@ dependencies:
|
|
108
150
|
- - ">="
|
109
151
|
- !ruby/object:Gem::Version
|
110
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: sqlite3
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
111
167
|
description: Render your notifications on multiple platforms by specifying notification
|
112
168
|
types.
|
113
169
|
email: me@jonhue.me
|
@@ -126,7 +182,7 @@ files:
|
|
126
182
|
- lib/notification-renderer.rb
|
127
183
|
- lib/notification_renderer/configuration.rb
|
128
184
|
- lib/notification_renderer/engine.rb
|
129
|
-
- lib/notification_renderer/
|
185
|
+
- lib/notification_renderer/notification_lib.rb
|
130
186
|
- lib/notification_renderer/notification_scopes.rb
|
131
187
|
homepage: https://github.com/jonhue/notifications-rails/tree/master/notification-renderer
|
132
188
|
licenses:
|
@@ -147,8 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
203
|
- !ruby/object:Gem::Version
|
148
204
|
version: '0'
|
149
205
|
requirements: []
|
150
|
-
|
151
|
-
rubygems_version: 2.7.6
|
206
|
+
rubygems_version: 3.0.3
|
152
207
|
signing_key:
|
153
208
|
specification_version: 4
|
154
209
|
summary: Render your notifications on multiple platforms by specifying notification
|