notification-renderer 1.0.0.beta10 → 1.0.0.beta11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c91d69af1696634bffca82fa009a09422623f291f6b8fd7e7c57c2101d30fa2
4
- data.tar.gz: f42294a5a80b5669171e2245b30f48e6590e27070a2bddd83f2e17d7b961bc9c
3
+ metadata.gz: 9c811be378ae541e5905b91880085b0ac1117d5706d9771c8520ef42deb17a79
4
+ data.tar.gz: 2e806bed04c6e3650a4e4d617e543e70cfab50904fba85c3d416052ea33dc875
5
5
  SHA512:
6
- metadata.gz: 4c4ad10cc9f9349cca61fb408cce1feb7e404c9264c0824e8f842e75814ddb5879d7f05d5f23574c0cf837b1c111d85927f2e5434a9a0fd716d4838d71d0d1ec
7
- data.tar.gz: 97e95ac880751335ebb20cf890e7d04e1d8796a6c9dbc49f9965ccedb1c7a7b8e17ea4a4c0f4c7823aa3024bee9b410e410d0508d68c890181530440b5cb7894
6
+ metadata.gz: 609d6e962ac8c19a911e403c8483ac6d57dc84b421f4d50b719ac4eea2d7f6b71f5fd361ac4f9a0f077ac5f7cb4fc5f145109cda57f8f4a27a82c083b01544dd
7
+ data.tar.gz: b828711515fa684348a8954fc26f779ec0b380faa59996cf28f37d13a33262acba52d631a899bbba201353fc899b2e3110c3d236135ff9dd66a374093fb317b0
@@ -0,0 +1,28 @@
1
+ module NotificationRendererHelper
2
+
3
+ def render_notification notification, renderer = NotificationRenderer.configuration.default_renderer, attribute, notifications_count
4
+ notification.update_attributes read: true if NotificationRenderer.configuration.auto_read
5
+ render "notifications/#{notification.type}/#{renderer}", notification: notification, attribute: attribute, notifications_count: notifications_count
6
+ end
7
+
8
+ def render_notifications notifications, renderer = NotificationRenderer.configuration.default_renderer
9
+ content_tag :div, class: 'notification-renderer notifications' do
10
+ notifications.each do |notification|
11
+ render_notification notification, renderer
12
+ end
13
+ end
14
+ end
15
+
16
+ def render_notifications_grouped notifications, group_by, renderer = NotificationRenderer.configuration.default_renderer
17
+ content_tag :div, class: 'notification-renderer notifications' do
18
+ notifications.grouping(group_by)&.each do |attribute, notifications|
19
+ render_notification notifications.last, renderer, attribute, notifications.count
20
+ end
21
+ end
22
+ end
23
+
24
+ def notification_grouped?
25
+ local_assigns[:attribute]
26
+ end
27
+
28
+ end
@@ -1,4 +1,5 @@
1
1
  require 'rails/railtie'
2
+ require 'action_view'
2
3
 
3
4
  module NotificationRenderer
4
5
  class Engine < ::Rails::Engine
@@ -1,3 +1,6 @@
1
+ require 'notification-handler'
2
+ require 'active_support'
3
+
1
4
  module NotificationRenderer
2
5
  module NotificationLibrary
3
6
 
@@ -1,3 +1,6 @@
1
+ require 'notification-handler'
2
+ require 'active_support'
3
+
1
4
  module NotificationRenderer
2
5
  module NotificationScopes
3
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notification-renderer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta10
4
+ version: 1.0.0.beta11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
@@ -38,20 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: notification-handler
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - '='
46
60
  - !ruby/object:Gem::Version
47
- version: 1.0.0.beta10
61
+ version: 1.0.0.beta11
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - '='
53
67
  - !ruby/object:Gem::Version
54
- version: 1.0.0.beta10
68
+ version: 1.0.0.beta11
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -90,6 +104,7 @@ files:
90
104
  - CHANGELOG.md
91
105
  - LICENSE
92
106
  - README.md
107
+ - app/helpers/notification_renderer_helper.rb
93
108
  - lib/generators/notification_renderer/install_generator.rb
94
109
  - lib/generators/notification_renderer/type_generator.rb
95
110
  - lib/generators/templates/install/README.md