signum 0.7.6 → 0.7.7
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_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: afc66ab9111c5abd8514d9886085a4009616b991088f8e942125fc193d3cb1b1
|
4
|
+
data.tar.gz: 5e86e69e0e07f2cff2f377ceb9dc652e41d2ec31069649f7bd364c74b04583b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0037367c3fbc51de0dacae3f556a6edfaed552c4dd1c6dc1b5ac6ae375d5f4fa59f1ab2c1d769851d5923b3a645ed4997ce979cc6cdd59924564cdd3f92cab12
|
7
|
+
data.tar.gz: 706885e899ea2fe06c37e8191f45e17196dfd4a020a39633337f07d4f626555125a055196c4784feec9b202178e3164fa5e0fcc676ecc6599edfc3bf4f63bb61
|
@@ -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.7
|
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-05-
|
11
|
+
date: 2024-05-24 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
|