signum 0.7.6 → 0.7.8
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.css +33 -34
- data/app/components/signum/notification_body/component_controller.js +16 -15
- data/app/components/signum/notification_drawer/component_controller.js +15 -14
- data/app/components/signum/notification_drawer_item/component_controller.js +16 -10
- data/app/controllers/signum/application_controller.rb +1 -1
- data/app/controllers/signum/signal_controller.rb +4 -3
- data/app/models/signum/signal.rb +4 -4
- data/lib/generators/signum/templates/config/initializers/signum.rb +2 -0
- data/lib/signum/configuration.rb +1 -3
- data/lib/signum/version.rb +1 -1
- metadata +2 -3
- data/app/controllers/signum/api_controller.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1a703dbf5da5ca31e1275493f067a917802fb4caa606a6697e7fc64a62bbefa
|
4
|
+
data.tar.gz: f00fb2a6e2ea3639c5b2237498e0e2ba67bb421f230a7ef1d719653d4c083e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 810b2c5ebf4a0d36053780454cb1b5f2bac99fa81a5bf6d4b96d3f5fd7e9563428b7640cae4b10d4f7626e2683bdfe7f64630e26310d8b042a7c1e2cb4c8639f
|
7
|
+
data.tar.gz: 66e80f730d6c3ad91097c613742e51ed8f3809b2b2c55792b115732e18edab27ca9ac38666ff7e60fba48a249ba63aa9b16f87a43ae8bac9619f29c08495ee8f
|
@@ -2,95 +2,94 @@
|
|
2
2
|
@apply flex flex-col w-full divide-y;
|
3
3
|
|
4
4
|
&__mb {
|
5
|
-
|
5
|
+
/* main body */
|
6
6
|
@apply flex basis-full divide-x;
|
7
7
|
|
8
8
|
&__bc {
|
9
|
-
|
9
|
+
/* body container */
|
10
10
|
@apply flex grow py-4 px-2 overflow-hidden;
|
11
11
|
|
12
12
|
&__ic {
|
13
|
-
|
13
|
+
/* icon container */
|
14
14
|
@apply grow-0 pl-2 pr-3;
|
15
|
-
|
16
|
-
svg.info
|
17
|
-
{
|
18
|
-
//icon info
|
19
|
-
@apply text-sky-400;
|
20
|
-
}
|
21
15
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
svg.info {
|
17
|
+
/* icon info */
|
18
|
+
@apply text-sky-400;
|
19
|
+
}
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
svg.success {
|
22
|
+
/* icon success */
|
23
|
+
@apply text-green-400;
|
24
|
+
}
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
svg.error {
|
27
|
+
/* icon error */
|
28
|
+
@apply text-red-400;
|
29
|
+
}
|
30
|
+
|
31
|
+
svg.warning {
|
32
|
+
/* icon warning */
|
33
|
+
@apply text-orange-400;
|
34
|
+
}
|
35
35
|
}
|
36
|
-
}
|
37
36
|
|
38
37
|
&__mc {
|
39
|
-
|
38
|
+
/* main container */
|
40
39
|
@apply grow text-left break-words overflow-hidden;
|
41
40
|
|
42
41
|
&__ti {
|
43
|
-
|
42
|
+
/* title */
|
44
43
|
@apply text-[0.81rem] font-medium text-gray-900;
|
45
44
|
}
|
46
45
|
|
47
46
|
&__tx {
|
48
|
-
|
47
|
+
/* text */
|
49
48
|
@apply text-xs text-gray-500 mt-1;
|
50
49
|
}
|
51
50
|
|
52
51
|
&__lkc {
|
53
|
-
|
52
|
+
/* links container */
|
54
53
|
@apply flex flex-wrap mt-3;
|
55
54
|
|
56
55
|
&__lk {
|
57
|
-
|
56
|
+
/* link */
|
58
57
|
@apply rounded-md text-xs font-medium text-gray-700 hover:text-gray-500 focus:outline-none mr-2;
|
59
58
|
}
|
60
59
|
}
|
61
60
|
|
62
61
|
&__attc {
|
63
|
-
|
62
|
+
/* attachments links container */
|
64
63
|
@apply flex flex-wrap mt-3;
|
65
64
|
|
66
65
|
&__att {
|
67
|
-
|
66
|
+
/* attachment link */
|
68
67
|
@apply rounded-md text-xs font-medium text-gray-700 hover:text-gray-500 focus:outline-none mr-2;
|
69
68
|
}
|
70
69
|
}
|
71
70
|
}
|
72
71
|
|
73
72
|
&__bcc {
|
74
|
-
|
73
|
+
/* close button container */
|
75
74
|
@apply grow-0 m-1;
|
76
75
|
|
77
76
|
&__b {
|
78
|
-
|
77
|
+
/* button */
|
79
78
|
@apply text-gray-400 hover:text-gray-500 cursor-pointer;
|
80
79
|
}
|
81
80
|
}
|
82
81
|
}
|
83
82
|
|
84
83
|
&__bmc {
|
85
|
-
|
84
|
+
/* buttons main container */
|
86
85
|
@apply flex grow-0 flex-col divide-y divide-gray-200;
|
87
86
|
|
88
87
|
&__bc {
|
89
|
-
|
88
|
+
/* buttons container */
|
90
89
|
@apply flex flex-1;
|
91
90
|
|
92
91
|
&__b {
|
93
|
-
|
92
|
+
/* button */
|
94
93
|
@apply flex w-full items-center justify-center text-xs font-medium text-gray-700 hover:text-gray-500 focus:outline-none px-4 py-3;
|
95
94
|
}
|
96
95
|
}
|
@@ -98,7 +97,7 @@
|
|
98
97
|
}
|
99
98
|
|
100
99
|
&__pbc {
|
101
|
-
|
100
|
+
/* progress bar container */
|
102
101
|
@apply basis-full p-1;
|
103
102
|
}
|
104
103
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import ApplicationController from "signum/controllers/application_controller"
|
2
|
+
import { post } from '@rails/request.js';
|
2
3
|
|
3
4
|
export default class extends ApplicationController {
|
4
5
|
static values = { type: String, timeout: Number, sticky: Boolean, signalId: String, signalState: String }
|
@@ -19,23 +20,23 @@ export default class extends ApplicationController {
|
|
19
20
|
}, 300)
|
20
21
|
}
|
21
22
|
|
22
|
-
markClose() {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
}
|
28
|
-
|
29
|
-
})
|
30
|
-
.then((res) => {
|
23
|
+
async markClose() {
|
24
|
+
try {
|
25
|
+
const response = await post('/signal/close', {
|
26
|
+
body: JSON.stringify({ id: this.signalIdValue }),
|
27
|
+
contentType: 'application/json'
|
28
|
+
});
|
29
|
+
if (response.ok) {
|
31
30
|
const niE = new CustomEvent("nd-item-activity", {
|
32
31
|
bubbles: true,
|
33
32
|
detail: "closed",
|
34
|
-
})
|
35
|
-
window.dispatchEvent(niE)
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
});
|
34
|
+
window.dispatchEvent(niE);
|
35
|
+
} else {
|
36
|
+
console.error('Error: ', response.statusText);
|
37
|
+
}
|
38
|
+
} catch (error) {
|
39
|
+
console.error('Request failed', error);
|
40
|
+
}
|
40
41
|
}
|
41
42
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import ApplicationController from "signum/controllers/application_controller"
|
2
|
+
import { post } from '@rails/request.js';
|
2
3
|
|
3
4
|
export default class extends ApplicationController {
|
4
5
|
static targets = ["alertBellIcon", "bellIcon", "submenu", "item", "crossIcon"]
|
@@ -33,22 +34,22 @@ export default class extends ApplicationController {
|
|
33
34
|
}
|
34
35
|
}
|
35
36
|
|
36
|
-
closeNotifications(event) {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
42
|
-
|
43
|
-
})
|
44
|
-
.then((res) => {
|
37
|
+
async closeNotifications(event) {
|
38
|
+
try {
|
39
|
+
const response = await post('/signal/close_all', {
|
40
|
+
body: JSON.stringify({}),
|
41
|
+
contentType: 'application/json'
|
42
|
+
});
|
43
|
+
if (response.ok) {
|
45
44
|
setTimeout(() => {
|
46
45
|
this.manageBellIcon()
|
47
|
-
}, 300)
|
48
|
-
}
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
}, 300);
|
47
|
+
} else {
|
48
|
+
console.error('Error: ', response.statusText);
|
49
|
+
}
|
50
|
+
} catch (error) {
|
51
|
+
console.error('Request failed', error);
|
52
|
+
}
|
52
53
|
}
|
53
54
|
|
54
55
|
itemActivity(event) {
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import ApplicationController from "signum/controllers/application_controller"
|
2
|
+
import { post } from '@rails/request.js';
|
2
3
|
|
3
4
|
export default class extends ApplicationController {
|
4
5
|
static targets = []
|
@@ -14,17 +15,22 @@ export default class extends ApplicationController {
|
|
14
15
|
})
|
15
16
|
window.dispatchEvent(niE)
|
16
17
|
if (this.signalStateValue == "broadcasted") {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
this.showSignal()
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
async showSignal() {
|
23
|
+
try {
|
24
|
+
const response = await post("/signal/show", {
|
22
25
|
body: JSON.stringify({ id: this.signalIdValue }),
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
contentType: 'application/json'
|
27
|
+
});
|
28
|
+
if (response.ok) {
|
29
|
+
} else {
|
30
|
+
console.error('Error: ', response.statusText);
|
31
|
+
}
|
32
|
+
} catch (error) {
|
33
|
+
console.error('Request failed', error);
|
28
34
|
}
|
29
35
|
}
|
30
36
|
}
|
@@ -1,5 +1,7 @@
|
|
1
|
+
require_dependency 'signum/application_controller'
|
2
|
+
|
1
3
|
module Signum
|
2
|
-
class SignalController <
|
4
|
+
class SignalController < ApplicationController
|
3
5
|
def show
|
4
6
|
signal = Signum::Signal.find(signal_params[:id])
|
5
7
|
signal.show! if signal.broadcasted?
|
@@ -13,8 +15,7 @@ module Signum
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def close_all
|
16
|
-
|
17
|
-
signals = current_user.signals.where.not(state: "closed")
|
18
|
+
signals = Signum.config.current_user.call.signals.where.not(state: "closed")
|
18
19
|
signals.each(&:close!)
|
19
20
|
head :ok
|
20
21
|
end
|
data/app/models/signum/signal.rb
CHANGED
@@ -14,10 +14,10 @@ module Signum
|
|
14
14
|
broadcast! if can_broadcast?
|
15
15
|
|
16
16
|
broadcast_prepend_to(:signals, target: Signum.config.balloon_notifications_container_id.call(key || signalable),
|
17
|
-
html:
|
17
|
+
html: ActionController::Base.render(Signum::Notification::Component.new(self)))
|
18
18
|
|
19
19
|
broadcast_prepend_to(:signals, target: Signum.config.drawer_notifications_container_id.call(key || signalable),
|
20
|
-
html:
|
20
|
+
html: ActionController::Base.render(Signum::NotificationDrawerItem::Component.new(signal: self)))
|
21
21
|
end
|
22
22
|
|
23
23
|
def broadcast_update
|
@@ -29,9 +29,9 @@ module Signum
|
|
29
29
|
end
|
30
30
|
|
31
31
|
broadcast_replace_to(:signals, target: Signum.config.notification_body_id.call(:balloon, self),
|
32
|
-
html:
|
32
|
+
html: ActionController::Base.render(Signum::NotificationBody::Component.new(self, {type: :balloon, timeout: 5})))
|
33
33
|
broadcast_replace_to(:signals, target: Signum.config.notification_body_id.call(:drawer_item, self),
|
34
|
-
html:
|
34
|
+
html: ActionController::Base.render(Signum::NotificationBody::Component.new(self, {type: :drawer_item, timeout: 5})))
|
35
35
|
end
|
36
36
|
|
37
37
|
validates :text, presence: true
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Signum.setup do |config|
|
4
|
+
config.base_controller = "::ApplicationController"
|
5
|
+
config.admin_authentication_module = "Authenticated"
|
4
6
|
config.hide_after = 60_000 if Rails.env.test?
|
5
7
|
config.current_user = -> { Current.user }
|
6
8
|
config.drawer_notifications_container_id = -> { "drawer_notifications_#{Current.user.id}" }
|
data/lib/signum/configuration.rb
CHANGED
@@ -32,9 +32,7 @@ module Signum
|
|
32
32
|
option :user_model_name, default: "User"
|
33
33
|
option :hide_after, default: 3000
|
34
34
|
option :base_controller, default: "::ApplicationController"
|
35
|
-
option :
|
36
|
-
option :base_service_context, default: "::ApplicationContext"
|
37
|
-
option :current_user, default: -> {}
|
35
|
+
option :current_user, default: lambda {}
|
38
36
|
option :drawer_notifications_container_id, default: ->(signalable = nil) {
|
39
37
|
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
38
|
}
|
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.8
|
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-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -242,7 +242,6 @@ files:
|
|
242
242
|
- app/components/signum/notification_drawer_item/component_controller.js
|
243
243
|
- app/components/signum/notifications/component.html.slim
|
244
244
|
- app/components/signum/notifications/component.rb
|
245
|
-
- app/controllers/signum/api_controller.rb
|
246
245
|
- app/controllers/signum/application_controller.rb
|
247
246
|
- app/controllers/signum/signal_controller.rb
|
248
247
|
- app/helpers/signum/application_helper.rb
|