signum 0.7.2 → 0.7.4

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
  SHA256:
3
- metadata.gz: 70f07ba920350cfcc01c51e62854936d070951d4a3dcf37ad381bf0d29e2c75f
4
- data.tar.gz: e8d35f2cd2a4c09033bcd87a69b7373fc6ea002c64001e9d0f64d8cc8c96cba7
3
+ metadata.gz: 9acff14e5d11f110525162eed1f0866c92b7dc9c22c1f7390658e463cc88b5f3
4
+ data.tar.gz: e4f284537c9c20296d9d113d294e12036963dd6390fc2090023be3c372e23895
5
5
  SHA512:
6
- metadata.gz: 6757ede07a145e076903f8cc667521166e99c8ff0215bb0e606d4f3dd15e7d21eab5a1dbe4fdd7712539fb16a743e21f67e74416b0ca1cc0ced422653b53f39f
7
- data.tar.gz: 3d263f2cc1d3d53604eea2c2c21b58dd648b10a79d8fb7593f8e6829ecf5c7a5c4327f78cf8dcb532d7daa94f465f0d1e48078f0f11e9c9bc01ce9ddfb6239ab
6
+ metadata.gz: 884944f576e484920bf7530da0b8be24a8fc2df82716ceb5712525398b8438da1ba5f4febcdcef6551da167ccc273a8c757e4746def498ac5eef6629c97e507c
7
+ data.tar.gz: e23ffab144d91f8f8c5b853acd5007220fc26b0e19a6e15c71d5a65cc2f2342bd6f3c7a19473d15bf151515e03762a33704de4c86de221b677f91853aa5502c9
@@ -1,4 +1,4 @@
1
- .signum-notification-body data-controller="signum-notification-body" data-signum-notification-body-type-value=data[:type] data-signum-notification-body-timeout-value=data[:timeout] data-signum-notification-body-sticky-value="#{signal.sticky.present? ? signal.sticky.to_s : 'false'}" data-signum-notification-body-signal-state-value="#{signal.state}" data-signum-notification-body-signal-id-value="#{signal.id}" id="notification_#{data[:type]}_#{signal.signalable_id}_#{signal.id}"
1
+ .signum-notification-body data-controller="signum-notification-body" data-signum-notification-body-type-value=data[:type] data-signum-notification-body-timeout-value=data[:timeout] data-signum-notification-body-sticky-value="#{signal.sticky.present? ? signal.sticky.to_s : 'false'}" data-signum-notification-body-signal-state-value="#{signal.state}" data-signum-notification-body-signal-id-value="#{signal.id}" id="#{Signum.config.notification_body_id.call(data[:type], signal)}"
2
2
  .signum-notification-body__mb
3
3
  .signum-notification-body__mb__bc
4
4
  .signum-notification-body__mb__bc__ic
@@ -15,7 +15,7 @@
15
15
  .signum-notification-body__mb__bc__mc__lkc
16
16
  - signal.links.each do | link |
17
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"), 'data-action': button["close"] ? "click->signum-notification-body#close" : "" }.merge(link.fetch("link_attributes", {}))
18
+ a.signum-notification-body__mb__bc__mc__lkc__lk*{href: link.fetch('url', '#'), target:link.fetch("target", "_blank"), 'data-action': link["close"] ? "click->signum-notification-body#close" : "" }.merge(link.fetch("link_attributes", {}))
19
19
  i.fas.fa-link
20
20
  =< link["title"] || link["url"] || '(...)'
21
21
  - if signal.attachments.attached?
@@ -1,8 +1,9 @@
1
- div.text-left[data-controller="signum-notification-drawer" data-action="mouseover->signum-notification-drawer#show mouseleave->signum-notification-drawer#hide click->signum-notification-drawer#closeNotifications"]
1
+ div.text-left[data-controller="signum-notification-drawer" data-action="mouseover->signum-notification-drawer#show mouseleave->signum-notification-drawer#hide"]
2
2
  button.signum-notification-drawer-button data-action="click->signum-notification-drawer#closeNotifications"
3
- i class="hidden #{Signum.config.icons[:unread_main]}" data-signum-notification-drawer-target='alertBellIcon'
4
- i class="#{Signum.config.icons[:read_main]}" data-signum-notification-drawer-target='bellIcon'
5
- i.hidden.fas.fa-times.cross-icon.text-xs.absolute.top-5.right-15#crossIcon data-signum-notification-drawer-target="crossIcon" data-action="click->signum-notification-drawer#closeNotifications"
3
+ span.pointer-events-none
4
+ i class="hidden #{Signum.config.icons[:unread_main]}" data-signum-notification-drawer-target='alertBellIcon'
5
+ i class="#{Signum.config.icons[:read_main]}" data-signum-notification-drawer-target='bellIcon'
6
+ i.hidden.fas.fa-times.cross-icon.text-xs.absolute.top-5.right-15#crossIcon data-signum-notification-drawer-target="crossIcon"
6
7
 
7
8
  .signum-notification-drawer-tray.hidden[data-signum-notification-drawer-target="submenu" id="#{Signum.config.drawer_notifications_container_id.call}"]
8
9
  = render(Signum::NotificationDrawerItem::Component.with_collection(signals))
@@ -1,7 +1,6 @@
1
1
  import ApplicationController from "signum/controllers/application_controller"
2
2
 
3
3
  export default class extends ApplicationController {
4
-
5
4
  static targets = ["alertBellIcon", "bellIcon", "submenu", "item", "crossIcon"]
6
5
 
7
6
  connect() {
@@ -11,7 +10,6 @@ export default class extends ApplicationController {
11
10
  setTimeout(() => {
12
11
  this.manageBellIcon()
13
12
  }, 300)
14
-
15
13
  }
16
14
 
17
15
  disconnect() {
@@ -36,19 +34,21 @@ export default class extends ApplicationController {
36
34
  }
37
35
 
38
36
  closeNotifications(event) {
39
- fetch("/signal/close_all", {
40
- method: "GET",
41
- headers: {
42
- "Content-Type": "application/json",
43
- },
37
+ fetch("/signal/close_all", {
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/json",
41
+ },
42
+ body: JSON.stringify({}),
43
+ })
44
+ .then((res) => {
45
+ setTimeout(() => {
46
+ this.manageBellIcon()
47
+ }, 300)
48
+ })
49
+ .catch((err) => {
50
+ console.log(err)
44
51
  })
45
- .then((res) => {})
46
- .catch((err) => {
47
- console.log(err)
48
- })
49
- this.crossIconTarget.style.display = 'none';
50
- this.bellIconTarget.style.display = 'inline-block'
51
- this.alertBellIconTarget.style.display = 'none';
52
52
  }
53
53
 
54
54
  itemActivity(event) {
@@ -66,6 +66,7 @@ export default class extends ApplicationController {
66
66
  } else {
67
67
  this.alertBellIconTarget.classList.add("hidden")
68
68
  this.bellIconTarget.classList.remove("hidden")
69
+ this.crossIconTarget.classList.add("hidden")
69
70
  }
70
71
  }
71
72
  }
@@ -13,7 +13,8 @@ module Signum
13
13
  end
14
14
 
15
15
  def close_all
16
- signals = Signum.config.current_user.call.signals.where.not(state: "closed")
16
+ # signals = Signum.config.current_user.call.signals.where.not(state: "closed") // current_user is nil when called from an api
17
+ signals = current_user.signals.where.not(state: "closed")
17
18
  signals.each(&:close!)
18
19
  head :ok
19
20
  end
@@ -13,10 +13,10 @@ module Signum
13
13
  def broadcast_create
14
14
  broadcast! if can_broadcast?
15
15
 
16
- broadcast_prepend_to(:signals, target: Signum.config.balloon_notifications_container_id.call(key || signalable, id),
16
+ broadcast_prepend_to(:signals, target: Signum.config.balloon_notifications_container_id.call(key || signalable),
17
17
  html: ApplicationController.render(Signum::Notification::Component.new(self)))
18
18
 
19
- broadcast_prepend_to(:signals, target: Signum.config.drawer_notifications_container_id.call(key || signalable, id),
19
+ broadcast_prepend_to(:signals, target: Signum.config.drawer_notifications_container_id.call(key || signalable),
20
20
  html: ApplicationController.render(Signum::NotificationDrawerItem::Component.new(signal: self)))
21
21
  end
22
22
 
@@ -28,9 +28,9 @@ module Signum
28
28
  return
29
29
  end
30
30
 
31
- broadcast_replace_to(:signals, target: Signum.config.balloon_notifications_container_id.call(key || signalable, id),
31
+ broadcast_replace_to(:signals, target: Signum.config.notification_body_id.call(:balloon, self),
32
32
  html: ApplicationController.render(Signum::NotificationBody::Component.new(self, {type: :balloon, timeout: 5})))
33
- broadcast_replace_to(:signals, target: Signum.config.drawer_notifications_container_id.call(key || signalable, id),
33
+ broadcast_replace_to(:signals, target: Signum.config.notification_body_id.call(:drawer_item, self),
34
34
  html: ApplicationController.render(Signum::NotificationBody::Component.new(self, {type: :drawer_item, timeout: 5})))
35
35
  end
36
36
 
data/config/routes.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  Signum::Engine.routes.draw do
2
2
  post "signal/show", to: "signal#show"
3
3
  post "signal/close", to: "signal#close"
4
- get "signal/close_all", to: "signal#close_all"
4
+ post "signal/close_all", to: "signal#close_all"
5
5
  post "signal/open_stickies", to: "signal#open_stickies"
6
6
  end
@@ -35,8 +35,15 @@ 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: ->(signalable = nil, id = nil) {}
39
- option :balloon_notifications_container_id, default: ->(signalable = nil, id = nil) {}
38
+ option :drawer_notifications_container_id, default: ->(signalable = nil) {
39
+ signalable.is_a?(String) ? "drawer_notifications_#{signalable}" : "drawer_notifications_#{(signalable || Signum.config.current_user.call)&.class&.name}_#{(signalable || Signum.config.current_user.call)&.id}"
40
+ }
41
+ option :balloon_notifications_container_id, default: ->(signalable = nil) {
42
+ signalable.is_a?(String) ? "balloon_notifications_#{signalable}" : "balloon_notifications_#{(signalable || Signum.config.current_user.call)&.class&.name}_#{(signalable || Signum.config.current_user.call)&.id}"
43
+ }
44
+ option :notification_body_id, default: ->(type = nil, signal = nil) {
45
+ "notification_#{type}_#{signal.signalable_id}_#{signal.id}"
46
+ }
40
47
  option :icons,
41
48
  default: {info: "fa-solid fa-circle-info fa-lg",
42
49
  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.7.2"
4
+ VERSION = "0.7.4"
5
5
  end
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.7.2
4
+ version: 0.7.4
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-04-10 00:00:00.000000000 Z
11
+ date: 2024-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg