signum 0.4.13 → 0.5.1

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: ed7099f07650630cdafb4863f0abcdbf1bcc3e2e77edbf4c130204fd5a148f60
4
- data.tar.gz: 59757f06d37a7a0e73911c69b1f8111ebc019905a9e585c21b9b8f8ddcce9776
3
+ metadata.gz: 80bcbf3b5c508331a717b1f9b17b7d14b06c88612f54635e45f87643453ddf5b
4
+ data.tar.gz: 5e44b69680cd000e0a048d595aa0539114b3fb1b9424a9b5812eff94d41d80fa
5
5
  SHA512:
6
- metadata.gz: 374e02bc0f6b76caeecfc49869c830ca025b98fef9eb7154c02fddffc899eb6bd9f3093017f336131f053dd5bfb45a8cc4b1ab13b95150639a550f19722dc60c
7
- data.tar.gz: 24ef26d963b3d1db38f09621cefae2994c054359f76ef7614de84c3db6dbe88765966a8ca53dba250a96196fc6368764dcbc0d96ed573b2e5945dc600acabd0c
6
+ metadata.gz: d698d607336e153b25d2dfbe5717bbdeb7338a88c77049dbfa7c40e24b3cbcdd2918baedb902e360b47b67a0bed9827b73bc9604562263c27de95279d89c9571
7
+ data.tar.gz: a94a9bea7fb4242fd2f9fd312ffbf2730bd4f8479244828ce977f39b54ea784c7b4048e0c66b6a04a133a1665a590d633964ade726d4af7b73414f3618bd2122
@@ -14,9 +14,10 @@
14
14
  - if signal.metadata.present? && signal.metadata["links"].present?
15
15
  .signum-notification-body__mb__bc__mc__lkc
16
16
  - signal.metadata["links"].each do | link |
17
- a.signum-notification-body__mb__bc__mc__lkc__lk href="#{link["url"]}" target=link.fetch("target", "_blank") *link["link_attributes"]
17
+ - next unless link.is_a?(Hash)
18
+ a.signum-notification-body__mb__bc__mc__lkc__lk*{href: link.fetch('url', '#'), target:link.fetch("target", "_blank") }.merge(link.fetch("link_attributes", {}))
18
19
  i.fas.fa-link
19
- =< link["title"]
20
+ =< link["title"] || link["url"] || '(...)'
20
21
  - if signal.attachments.attached?
21
22
  .signum-notification-body__mb__bc__mc__attc
22
23
  - signal.attachments.each do | attachment |
@@ -32,10 +33,11 @@
32
33
  - if signal.metadata.present? && signal.metadata["buttons"].present?
33
34
  .signum-notification-body__mb__bmc
34
35
  - signal.metadata["buttons"].each do | button |
36
+ - next unless button.is_a?(Hash)
35
37
  .signum-notification-body__mb__bmc__bc
36
- a.signum-notification-body__mb__bmc__bc__b href="#{button["url"]}" target=button.fetch("target", "_blank") *button["link_attributes"]
38
+ a.signum-notification-body__mb__bmc__bc__b*{href: button.fetch('url', '#'), target:button.fetch("target", "_blank")}.merge(button.fetch("link_attributes", {}))
37
39
  = button["title"]
38
40
  - if signal.count.present?
39
41
  - percentage = signal.total.present? ? signal.count.fdiv(signal.total) * 100 : signal.count
40
42
  .signum-notification-body__pbc
41
- = sts.progress_bar percentage, size: :small, label: false
43
+ = sts.progress_bar percentage, size: :small, label: false
@@ -13,7 +13,7 @@ export default class extends ApplicationController {
13
13
  close(event) {
14
14
  setTimeout(() => {
15
15
  this.element?.parentElement?.remove()
16
- if (event) {
16
+ if (event && this.typeValue != "balloon") {
17
17
  this.markClose()
18
18
  }
19
19
  }, 300)
@@ -0,0 +1,5 @@
1
+ = helpers.turbo_stream_from :signals
2
+
3
+ .pointer-events-none.fixed.inset-0.flex.items-end.px-2.py-6.sm:items-start.sm:p-6.z-10 data-turbo-permanent="true" id="signum_notifications"
4
+ #notifications_all.flex.w-full.flex-col.items-center.space-y-2.sm:items-end
5
+ div.flex.w-full.flex-col.items-center.space-y-2.sm:items-end[id="#{Signum.config.balloon_notifications_container_id.call}"]
@@ -0,0 +1,9 @@
1
+ module Signum
2
+ module Notifications
3
+ class Component < ViewComponent::Base
4
+
5
+ def initialize()
6
+ end
7
+ end
8
+ end
9
+ end
@@ -11,10 +11,10 @@ module Signum
11
11
  def broadcast_create
12
12
  broadcast! if can_broadcast?
13
13
 
14
- broadcast_prepend_to(:signals, target: Signum.config.balloon_notifications_container_id.call,
14
+ broadcast_prepend_to(:signals, target: Signum.config.balloon_notifications_container_id.call(signalable, id),
15
15
  html: ApplicationController.render(Signum::Notification::Component.new(self)))
16
16
 
17
- broadcast_prepend_to(:signals, target: Signum.config.drawer_notifications_container_id.call,
17
+ broadcast_prepend_to(:signals, target: Signum.config.drawer_notifications_container_id.call(signalable, id),
18
18
  html: ApplicationController.render(Signum::NotificationDrawerItem::Component.new(signal: self)))
19
19
  end
20
20
 
@@ -35,8 +35,8 @@ module Signum
35
35
  option :base_service, default: '::ApplicationService'
36
36
  option :base_service_context, default: '::ApplicationContext'
37
37
  option :current_user, default: -> {}
38
- option :drawer_notifications_container_id, default: -> {}
39
- option :balloon_notifications_container_id, default: -> {}
38
+ option :drawer_notifications_container_id, default: ->(signalable = nil, id = nil) {}
39
+ option :balloon_notifications_container_id, default: ->(signalable = nil, id = nil) {}
40
40
  option :icons,
41
41
  default: { info: 'fa-solid fa-circle-info fa-lg',
42
42
  error: 'fa-solid fa-square-xmark fa-lg',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Signum
4
- VERSION = "0.4.13"
4
+ VERSION = "0.5.1"
5
5
  end
data/signum.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'pg'
22
22
  spec.add_dependency 'rails', '> 6.0'
23
- spec.add_dependency 'state_machines-activemodel'
23
+ spec.add_dependency 'state_machines-activerecord'
24
24
 
25
25
  spec.add_development_dependency 'auxilium', '~> 3'
26
26
  spec.add_development_dependency 'sqlite3'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-24 00:00:00.000000000 Z
11
+ date: 2024-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '6.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: state_machines-activemodel
42
+ name: state_machines-activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -183,6 +183,8 @@ files:
183
183
  - app/components/signum/notification_drawer_item/component.html.slim
184
184
  - app/components/signum/notification_drawer_item/component.rb
185
185
  - app/components/signum/notification_drawer_item/component_controller.js
186
+ - app/components/signum/notifications/component.html.slim
187
+ - app/components/signum/notifications/component.rb
186
188
  - app/controllers/signum/api_controller.rb
187
189
  - app/controllers/signum/application_controller.rb
188
190
  - app/controllers/signum/signal_controller.rb