signum 0.7.2 → 0.7.5
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/app/components/signum/notification_body/component.html.slim +2 -2
- data/app/components/signum/notification_drawer/component.css +6 -2
- data/app/components/signum/notification_drawer/component.html.slim +5 -4
- data/app/components/signum/notification_drawer/component_controller.js +15 -14
- data/app/components/signum/notification_drawer_item/component.css +3 -0
- data/app/components/signum/notification_drawer_item/component.html.slim +1 -1
- data/app/controllers/signum/signal_controller.rb +2 -1
- data/app/models/signum/signal.rb +4 -4
- data/config/routes.rb +1 -1
- data/lib/signum/configuration.rb +9 -2
- data/lib/signum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f87010b99c492e34fc25f40723d342e8be855227325fce7e2d46a994a17dd7a3
|
|
4
|
+
data.tar.gz: cd57547cc2a41aca654baa57d67c1edaffcaf17038c1f94f113d456fe9f76ce9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66b110d7fb891c4e28f8ec30d75544194e1763db325ba11a693c522f4a50c2571d2a6b72226d074540df48c9234b4abfa8ae88065c3c1e1babb3d9ec8f95fc4d
|
|
7
|
+
data.tar.gz: 12ac20d0313cc9a299d93251420d4e71a387c29c1b171e0ced12814f71048bdceb6845318d55a291aa325871656b4f0acc6835d4477abe858881c1505f78b06c
|
|
@@ -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="
|
|
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':
|
|
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,7 +1,11 @@
|
|
|
1
1
|
.signum-notification-drawer-button {
|
|
2
|
-
@apply w-8 h-8 bg-white m-0 rounded-full text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 dark:bg-gray-
|
|
2
|
+
@apply w-8 h-8 bg-white m-0 rounded-full text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 dark:bg-gray-800 dark:border-gray-700;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.signum-notification-drawer-tray {
|
|
6
|
-
@apply bg-gray-50 w-full max-w-sm absolute right-0 z-10 mx-1 w-1/3 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 overflow-y-auto max-h-[75vh];
|
|
6
|
+
@apply bg-gray-50 w-full max-w-sm absolute right-0 z-10 mx-1 w-1/3 origin-top-right divide-y dark:shadow-gray-600 dark:shadow-lg divide-gray-100 dark:bg-gray-900 dark:bg-opacity-95 bg-opacity-95 dark:border-gray-700 dark:divide-gray-800 rounded-md bg-white shadow-lg dark:outline-white ring-1 ring-black ring-opacity-5 overflow-y-auto max-h-[75vh];
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
.signum-notification-drawer-item {
|
|
10
|
+
@apply dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-gray-800;
|
|
11
|
+
}
|
|
@@ -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
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.
|
|
1
|
+
.signum-notification-drawer-item data-controller="signum-notification-drawer-item" data-signum-notification-drawer-target="item" data-signum-notification-drawer-item-signal-state-value="#{signal.state}" data-signum-notification-drawer-item-signal-id-value="#{signal.id}" id="notification_#{data[:type]}_parent_#{signal.signalable_id}_#{signal.id}"
|
|
2
2
|
= render(Signum::NotificationBody::Component.new(signal, data))
|
|
@@ -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
|
data/app/models/signum/signal.rb
CHANGED
|
@@ -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
|
|
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
|
|
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.
|
|
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.
|
|
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
|
-
|
|
4
|
+
post "signal/close_all", to: "signal#close_all"
|
|
5
5
|
post "signal/open_stickies", to: "signal#open_stickies"
|
|
6
6
|
end
|
data/lib/signum/configuration.rb
CHANGED
|
@@ -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
|
|
39
|
-
|
|
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",
|
data/lib/signum/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.7.5
|
|
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-
|
|
11
|
+
date: 2024-05-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pg
|