signum 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Gemfile.lock +7 -14
- data/README.md +4 -4
- data/app/components/signum/notification_body/component.html.slim +10 -8
- data/app/components/signum/notification_drawer/component.html.slim +5 -4
- data/app/components/signum/notification_drawer/component_controller.js +33 -1
- data/app/controllers/signum/signal_controller.rb +8 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20240405112807_add_links_and_buttons_to_signals.rb +6 -0
- data/lib/signum/version.rb +1 -1
- metadata +3 -3
- data/webpack.config.js +0 -126
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65ddec675d519cebd682d685b2da8fece2db0b66d4e3dddaa130eb292f2b6e89
|
4
|
+
data.tar.gz: c02695a0e0b5978ff7e5b1595dcabcb034aace639682046899beb3fb34ec72a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96b4491e10ccc698f14b52a0b11a94476fc3cd4652e798a1b1b3e782227f1d636d8c676c4485e24bed6d35bbd991f42c5c74bfbe6b17bed8896e613800aea8bf
|
7
|
+
data.tar.gz: 0f826ed2651e4fce6a779fbefda95b6496b74416938deb2fdc271762ead8af55de799e6aa5abd0036912e936f90ad769579363d7dd126c87f8d574852c855275
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -13,12 +13,12 @@ GIT
|
|
13
13
|
PATH
|
14
14
|
remote: .
|
15
15
|
specs:
|
16
|
-
signum (0.
|
16
|
+
signum (0.5.1)
|
17
17
|
importmap-rails
|
18
18
|
pg
|
19
19
|
rails (> 6.0)
|
20
20
|
slim-rails (~> 3)
|
21
|
-
state_machines-
|
21
|
+
state_machines-activerecord
|
22
22
|
stimulus-rails
|
23
23
|
tailwindcss-rails
|
24
24
|
turbo-rails
|
@@ -122,7 +122,6 @@ GEM
|
|
122
122
|
irb (1.11.2)
|
123
123
|
rdoc
|
124
124
|
reline (>= 0.4.2)
|
125
|
-
language_server-protocol (3.17.0.3)
|
126
125
|
loofah (2.22.0)
|
127
126
|
crass (~> 1.0.2)
|
128
127
|
nokogiri (>= 1.12.0)
|
@@ -143,14 +142,13 @@ GEM
|
|
143
142
|
net-protocol
|
144
143
|
net-protocol (0.2.2)
|
145
144
|
timeout
|
146
|
-
net-smtp (0.
|
145
|
+
net-smtp (0.5.0)
|
147
146
|
net-protocol
|
148
|
-
nio4r (2.7.
|
147
|
+
nio4r (2.7.1)
|
149
148
|
nokogiri (1.16.2)
|
150
149
|
mini_portile2 (~> 2.8.2)
|
151
150
|
racc (~> 1.4)
|
152
151
|
pg (1.5.6)
|
153
|
-
prettier_print (1.2.1)
|
154
152
|
psych (5.1.2)
|
155
153
|
stringio
|
156
154
|
pundit (2.3.1)
|
@@ -202,10 +200,6 @@ GEM
|
|
202
200
|
actionpack (>= 5.2)
|
203
201
|
railties (>= 5.2)
|
204
202
|
rolify (6.0.1)
|
205
|
-
ruby-lsp (0.3.8)
|
206
|
-
language_server-protocol (~> 3.17.0)
|
207
|
-
sorbet-runtime
|
208
|
-
syntax_tree (>= 5.0.0, < 6)
|
209
203
|
ruby2_keywords (0.0.5)
|
210
204
|
slim (5.2.1)
|
211
205
|
temple (~> 0.10.0)
|
@@ -214,7 +208,6 @@ GEM
|
|
214
208
|
actionpack (>= 3.1)
|
215
209
|
railties (>= 3.1)
|
216
210
|
slim (>= 3.0, < 6.0, != 5.0.0)
|
217
|
-
sorbet-runtime (0.5.11276)
|
218
211
|
sprockets (4.2.1)
|
219
212
|
concurrent-ruby (~> 1.0)
|
220
213
|
rack (>= 2.2.4, < 4)
|
@@ -228,11 +221,12 @@ GEM
|
|
228
221
|
state_machines-activemodel (0.9.0)
|
229
222
|
activemodel (>= 6.0)
|
230
223
|
state_machines (>= 0.6.0)
|
224
|
+
state_machines-activerecord (0.9.0)
|
225
|
+
activerecord (>= 6.0)
|
226
|
+
state_machines-activemodel (>= 0.9.0)
|
231
227
|
stimulus-rails (1.3.3)
|
232
228
|
railties (>= 6.0.0)
|
233
229
|
stringio (3.1.0)
|
234
|
-
syntax_tree (5.3.0)
|
235
|
-
prettier_print (>= 1.2.0)
|
236
230
|
tailwindcss-rails (2.3.0)
|
237
231
|
railties (>= 6.0.0)
|
238
232
|
temple (0.10.3)
|
@@ -256,7 +250,6 @@ PLATFORMS
|
|
256
250
|
|
257
251
|
DEPENDENCIES
|
258
252
|
auxilium (~> 3)!
|
259
|
-
ruby-lsp (~> 0.3.2)
|
260
253
|
signum!
|
261
254
|
sprockets-rails
|
262
255
|
sqlite3
|
data/README.md
CHANGED
@@ -51,14 +51,14 @@ s = Signum.signal(Current.user, text: "Hello World New", title: "Icon", icon:'fa
|
|
51
51
|
|
52
52
|
Buttons and links:
|
53
53
|
```ruby
|
54
|
-
s = Signum.success(Current.user, text: "Hello World New", title: "Link1",
|
55
|
-
s = Signum.signal(Current.user, text: "Hello World New", title: "Link2",
|
56
|
-
s = Signum.signal(Current.user, text: "Hello World New", title: "Link2",
|
54
|
+
s = Signum.success(Current.user, text: "Hello World New", title: "Link1", buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}])
|
55
|
+
s = Signum.signal(Current.user, text: "Hello World New", title: "Link2", buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}], icon: 'fa-regular fa-t-rex')
|
56
|
+
s = Signum.signal(Current.user, text: "Hello World New", title: "Link2", buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"},{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"},{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}])
|
57
57
|
```
|
58
58
|
|
59
59
|
You can also show a progressbar, this is based on count and total. Setting the count to total completes the progressbar.
|
60
60
|
```ruby
|
61
|
-
s = Signum.success(Current.user, text: "Hello World New", title: "this is test title",
|
61
|
+
s = Signum.success(Current.user, text: "Hello World New", title: "this is test title", buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}], count: 75, total: 150)
|
62
62
|
```
|
63
63
|
|
64
64
|
You can also attach attachments
|
@@ -11,12 +11,13 @@
|
|
11
11
|
- if signal.text.present?
|
12
12
|
p.signum-notification-body__mb__bc__mc__tx
|
13
13
|
= sanitize signal.text
|
14
|
-
- if signal.
|
14
|
+
- if signal.links.present?
|
15
15
|
.signum-notification-body__mb__bc__mc__lkc
|
16
|
-
- signal.
|
17
|
-
|
16
|
+
- signal.links.each do | link |
|
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
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 |
|
@@ -29,13 +30,14 @@
|
|
29
30
|
| Close
|
30
31
|
svg.h-5.w-5[xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentColor" aria-hidden="true"]
|
31
32
|
path[d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"]
|
32
|
-
- if signal.
|
33
|
+
- if signal.buttons.present?
|
33
34
|
.signum-notification-body__mb__bmc
|
34
|
-
- signal.
|
35
|
+
- signal.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
|
38
|
+
a.signum-notification-body__mb__bmc__bc__b*{href: button.fetch('url', '#'), target: button.fetch("target", "_blank"), 'data-action': button["close"] ? "click->signum-notification-body#close" : "" }.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
|
@@ -1,7 +1,8 @@
|
|
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 click->signum-notification-drawer#closeNotifications"]
|
2
2
|
button.signum-notification-drawer-button
|
3
|
-
|
4
|
-
|
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"
|
5
6
|
|
6
7
|
.signum-notification-drawer-tray.hidden[data-signum-notification-drawer-target="submenu" id="#{Signum.config.drawer_notifications_container_id.call}"]
|
7
|
-
= render(Signum::NotificationDrawerItem::Component.with_collection(signals))
|
8
|
+
= render(Signum::NotificationDrawerItem::Component.with_collection(signals))
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import ApplicationController from "signum/controllers/application_controller"
|
2
2
|
|
3
3
|
export default class extends ApplicationController {
|
4
|
-
|
4
|
+
|
5
|
+
static targets = ["alertbellicon", "bellicon", "submenu", "item", "crossicon"]
|
5
6
|
|
6
7
|
connect() {
|
7
8
|
this.bounditemActivity = this.itemActivity.bind(this)
|
@@ -10,6 +11,7 @@ export default class extends ApplicationController {
|
|
10
11
|
setTimeout(() => {
|
11
12
|
this.manageBellIcon()
|
12
13
|
}, 300)
|
14
|
+
|
13
15
|
}
|
14
16
|
|
15
17
|
disconnect() {
|
@@ -19,6 +21,11 @@ export default class extends ApplicationController {
|
|
19
21
|
show(event) {
|
20
22
|
if (this.submenuTarget.children.length > 0) {
|
21
23
|
this.submenuTarget.classList.remove("hidden")
|
24
|
+
if (event.altKey) {
|
25
|
+
this.crossiconTarget.style.display = 'inline-block'
|
26
|
+
} else {
|
27
|
+
this.crossiconTarget.style.display = 'none'
|
28
|
+
}
|
22
29
|
} else {
|
23
30
|
this.submenuTarget.classList.add("hidden")
|
24
31
|
}
|
@@ -26,6 +33,31 @@ export default class extends ApplicationController {
|
|
26
33
|
|
27
34
|
hide(event) {
|
28
35
|
this.submenuTarget.classList.add("hidden")
|
36
|
+
this.crossiconTarget.style.display = 'none'
|
37
|
+
if (this.submenuTarget.children.length < 0) {
|
38
|
+
this.alertbelliconTarget.classList.add("hidden")
|
39
|
+
}
|
40
|
+
if (event.altKey) {
|
41
|
+
this.crossiconTarget.style.display = 'none'
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
closeNotifications(event) {
|
46
|
+
if (event.altKey) {
|
47
|
+
fetch("/signal/close_all", {
|
48
|
+
method: "GET",
|
49
|
+
headers: {
|
50
|
+
"Content-Type": "application/json",
|
51
|
+
},
|
52
|
+
})
|
53
|
+
.then((res) => {})
|
54
|
+
.catch((err) => {
|
55
|
+
console.log(err)
|
56
|
+
})
|
57
|
+
this.crossiconTarget.style.display = 'none';
|
58
|
+
this.belliconTarget.style.display = 'inline-block'
|
59
|
+
this.alertbelliconTarget.style.display = 'none';
|
60
|
+
}
|
29
61
|
}
|
30
62
|
|
31
63
|
itemActivity(event) {
|
@@ -3,11 +3,19 @@ module Signum
|
|
3
3
|
def show
|
4
4
|
signal = Signum::Signal.find(signal_params[:id])
|
5
5
|
signal.show! if signal.broadcasted?
|
6
|
+
head :ok
|
6
7
|
end
|
7
8
|
|
8
9
|
def close
|
9
10
|
signal = Signum::Signal.find(signal_params[:id])
|
10
11
|
signal.close!
|
12
|
+
head :ok
|
13
|
+
end
|
14
|
+
|
15
|
+
def close_all
|
16
|
+
signals = current_user.signals.where.not(state: 'closed')
|
17
|
+
signals.each(&:close!)
|
18
|
+
head :ok
|
11
19
|
end
|
12
20
|
|
13
21
|
private
|
data/config/routes.rb
CHANGED
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.
|
4
|
+
version: 0.6.0
|
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-
|
11
|
+
date: 2024-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -204,6 +204,7 @@ files:
|
|
204
204
|
- db/migrate/20201125175035_create_signum_signals.rb
|
205
205
|
- db/migrate/20230317123138_add_columns_to_signum_signal.rb
|
206
206
|
- db/migrate/20231218095011_add_subject_to_signals.rb
|
207
|
+
- db/migrate/20240405112807_add_links_and_buttons_to_signals.rb
|
207
208
|
- lib/generators/signum/install_generator.rb
|
208
209
|
- lib/generators/signum/tailwind_config_generator.rb
|
209
210
|
- lib/generators/signum/templates/config/initializers/signum.rb
|
@@ -216,7 +217,6 @@ files:
|
|
216
217
|
- package.json
|
217
218
|
- signum.gemspec
|
218
219
|
- vendor/javascript/@hotwired--stimulus.js
|
219
|
-
- webpack.config.js
|
220
220
|
- yarn.lock
|
221
221
|
homepage: https://github.com/entdec/signum
|
222
222
|
licenses:
|
data/webpack.config.js
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
const path = require('path');
|
2
|
-
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
3
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
4
|
-
|
5
|
-
module.exports = {
|
6
|
-
entry: './frontend/src/signum.js',
|
7
|
-
output: {
|
8
|
-
path: __dirname + '/frontend/dist',
|
9
|
-
filename: 'signum.js',
|
10
|
-
library: 'Signum',
|
11
|
-
libraryTarget: 'umd'
|
12
|
-
},
|
13
|
-
plugins: [
|
14
|
-
// new CleanWebpackPlugin(['frontend/dist'], {}),
|
15
|
-
new MiniCssExtractPlugin({
|
16
|
-
filename: 'signum.css'
|
17
|
-
})
|
18
|
-
],
|
19
|
-
module: {
|
20
|
-
rules: [
|
21
|
-
{
|
22
|
-
test: /\.js$/,
|
23
|
-
exclude: /(node_modules|bower_components)/,
|
24
|
-
use: {
|
25
|
-
loader: 'babel-loader',
|
26
|
-
options: {
|
27
|
-
presets: ['env'],
|
28
|
-
plugins: ["transform-class-properties"]
|
29
|
-
}
|
30
|
-
}
|
31
|
-
},
|
32
|
-
{
|
33
|
-
test: /\.(|ttf|eot|svg|woff2?)(\?[\s\S]+)?$/,
|
34
|
-
use: 'file-loader',
|
35
|
-
},
|
36
|
-
{
|
37
|
-
test: /\.(sass|scss|css)$/,
|
38
|
-
use: [
|
39
|
-
{
|
40
|
-
loader: MiniCssExtractPlugin.loader,
|
41
|
-
},
|
42
|
-
'css-loader?sourceMap=false',
|
43
|
-
'sass-loader?sourceMap=false'
|
44
|
-
]
|
45
|
-
}
|
46
|
-
]
|
47
|
-
},
|
48
|
-
resolve: {
|
49
|
-
modules: [path.resolve('./node_modules'), path.resolve('./src')],
|
50
|
-
extensions: ['.json', '.js']
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
// const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
57
|
-
// const path = require('path');
|
58
|
-
|
59
|
-
// const devMode = process.env.NODE_ENV !== 'production'
|
60
|
-
|
61
|
-
// module.exports = {
|
62
|
-
// mode: devMode ? "development" : "production",
|
63
|
-
// entry: {
|
64
|
-
// signum: ['./frontend/src/signum.js']
|
65
|
-
// },
|
66
|
-
// output: {
|
67
|
-
// path: __dirname + '/frontend/dist',
|
68
|
-
// filename: '[name].js',
|
69
|
-
// },
|
70
|
-
|
71
|
-
// module: {
|
72
|
-
// rules: [
|
73
|
-
// {
|
74
|
-
// test: /\.(c|sa|sc)ss$/,
|
75
|
-
// exclude: /(node_modules)/,
|
76
|
-
// // Use the following loaders from right-to-left, so it will
|
77
|
-
// // use sass-loader first and ending with MiniCssExtractPlugin
|
78
|
-
// use: [
|
79
|
-
// {
|
80
|
-
// // Extracts the CSS into a separate file and uses the
|
81
|
-
// // defined configurations in the 'plugins' section
|
82
|
-
// loader: MiniCssExtractPlugin.loader
|
83
|
-
// },
|
84
|
-
// {
|
85
|
-
// // Interprets CSS
|
86
|
-
// loader: "css-loader",
|
87
|
-
// options: {
|
88
|
-
// importLoaders: 2
|
89
|
-
// }
|
90
|
-
// },
|
91
|
-
// {
|
92
|
-
// // Adds support for Sass files, if using Less, then
|
93
|
-
// // use the less-loader
|
94
|
-
// loader: "sass-loader"
|
95
|
-
// }
|
96
|
-
// ]
|
97
|
-
// },
|
98
|
-
// {
|
99
|
-
// test: /\.js$/,
|
100
|
-
// exclude: /(node_moduldes)/,
|
101
|
-
// use: {
|
102
|
-
// loader: 'babel-loader',
|
103
|
-
// options: {
|
104
|
-
// presets: ['@babel/preset-env']
|
105
|
-
// }
|
106
|
-
// }
|
107
|
-
// },
|
108
|
-
// {
|
109
|
-
// test: /\.(ttf|eot|svg|woff2?)(\?[\s\S]+)?$/,
|
110
|
-
// use: 'file-loader',
|
111
|
-
// },
|
112
|
-
// ]
|
113
|
-
// },
|
114
|
-
// plugins: [
|
115
|
-
// // Configuration options for MiniCssExtractPlugin. Here I'm only
|
116
|
-
// // indicating what the CSS output file name should be and
|
117
|
-
// // the location
|
118
|
-
// new MiniCssExtractPlugin({
|
119
|
-
// filename: devMode ? "[name].css" : "[name].min.css"
|
120
|
-
// })
|
121
|
-
// ],
|
122
|
-
// resolve: {
|
123
|
-
// modules: [path.resolve('./node_modules'), path.resolve('./src')],
|
124
|
-
// extensions: ['.json', '.js']
|
125
|
-
// }
|
126
|
-
// }
|