satis 2.4.0 → 2.4.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 467de347e9ddb8e9db29d0cde98d1e047e1de5ba86a09fdb8c276548ef3712cd
|
|
4
|
+
data.tar.gz: 7fdba4bdbe01342fe65d547b6c3beceb58bdc829b3008156d720ac4842c90263
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef091872ca731e27988e02d45d36321fae901d54eedda2d9c59dfa2d68f524f2a30b86c0633d7018b16357e8c194733ca48199cbc2518256eeb7b07c3cd1f022
|
|
7
|
+
data.tar.gz: 936bb15f39c3261c57592e9347e228d63db6f853b418480a1a5350b3f9a10d628bdafa8ebb888bf4e1a2822f315477c87ad84670d4c4a1f6166d4fa5601093ac
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ApplicationController from "satis/controllers/application_controller"
|
|
1
|
+
import ApplicationController from "satis/controllers/application_controller";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Usage:
|
|
@@ -26,20 +26,20 @@ import ApplicationController from "satis/controllers/application_controller"
|
|
|
26
26
|
= address_form.input :company_name
|
|
27
27
|
*/
|
|
28
28
|
export default class extends ApplicationController {
|
|
29
|
-
static targets = ["toggleable", "insertion", "input"]
|
|
29
|
+
static targets = ["toggleable", "insertion", "input"];
|
|
30
30
|
|
|
31
31
|
connect() {
|
|
32
|
-
this.boundUpdate = this.update.bind(this)
|
|
32
|
+
this.boundUpdate = this.update.bind(this);
|
|
33
33
|
this.inputTargets.forEach((input) => {
|
|
34
|
-
input.addEventListener("change", this.boundUpdate)
|
|
35
|
-
})
|
|
36
|
-
this.update()
|
|
34
|
+
input.addEventListener("change", this.boundUpdate);
|
|
35
|
+
});
|
|
36
|
+
this.update();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
disconnect() {
|
|
40
40
|
this.inputTargets.forEach((input) => {
|
|
41
|
-
input.removeEventListener("change", this.boundUpdate)
|
|
42
|
-
})
|
|
41
|
+
input.removeEventListener("change", this.boundUpdate);
|
|
42
|
+
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
update(event) {
|
|
@@ -48,61 +48,72 @@ export default class extends ApplicationController {
|
|
|
48
48
|
* process before we overwrite the template nodes that are possibly updated and reinsert new nodes.
|
|
49
49
|
*/
|
|
50
50
|
setTimeout(() => {
|
|
51
|
-
this.toggle(this.currentValue)
|
|
52
|
-
})
|
|
51
|
+
this.toggle(this.currentValue);
|
|
52
|
+
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
toggle(value) {
|
|
56
56
|
// Update template nodes before we swap
|
|
57
57
|
this.toggleableTargets.forEach((target) => {
|
|
58
|
-
target.content.childNodes.forEach(child => {
|
|
59
|
-
|
|
58
|
+
target.content.childNodes.forEach((child) => {
|
|
59
|
+
if (typeof child.getAttribute != "function") return;
|
|
60
|
+
let targetNodeId = child.getAttribute("data-toggleable-node-id");
|
|
60
61
|
if (!targetNodeId) return true;
|
|
61
62
|
|
|
62
|
-
this.insertionTarget.childNodes.forEach(iNode => {
|
|
63
|
+
this.insertionTarget.childNodes.forEach((iNode) => {
|
|
63
64
|
if (iNode.getAttribute("data-toggleable-node-id") == targetNodeId) {
|
|
64
65
|
if (child.parentElement) {
|
|
65
|
-
child.outerHTML = iNode.outerHTML
|
|
66
|
-
iNode.remove()
|
|
66
|
+
child.outerHTML = iNode.outerHTML;
|
|
67
|
+
iNode.remove();
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
|
-
})
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
72
73
|
|
|
73
74
|
// Clear the insertion target
|
|
74
|
-
this.insertionTarget.innerHTML = ""
|
|
75
|
+
this.insertionTarget.innerHTML = "";
|
|
75
76
|
|
|
76
77
|
// Reinsert elements
|
|
77
78
|
this.toggleableTargets.forEach((element) => {
|
|
78
|
-
if (
|
|
79
|
-
element.
|
|
79
|
+
if (
|
|
80
|
+
element.getAttribute("data-toggle-value") == value ||
|
|
81
|
+
(element.getAttribute("data-toggle-not-value") != null &&
|
|
82
|
+
element.getAttribute("data-toggle-not-value") != value)
|
|
83
|
+
) {
|
|
84
|
+
element.content.childNodes.forEach((node) => this.setUniqueId(node));
|
|
80
85
|
|
|
81
|
-
let toggleContent = document.importNode(element.content, true)
|
|
86
|
+
let toggleContent = document.importNode(element.content, true);
|
|
82
87
|
toggleContent.childNodes.forEach((child) => {
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
if (typeof child.outerHTML != "undefined") {
|
|
89
|
+
this.insertionTarget.insertAdjacentHTML(
|
|
90
|
+
"beforeend",
|
|
91
|
+
child.outerHTML,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
85
95
|
}
|
|
86
|
-
})
|
|
96
|
+
});
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
get currentValue() {
|
|
90
100
|
if (this.inputTargets.length >= 1 && this.inputTargets[0].type == "radio") {
|
|
91
|
-
return this.inputTargets.find((input) => input.checked)?.value
|
|
101
|
+
return this.inputTargets.find((input) => input.checked)?.value;
|
|
92
102
|
} else if (this.inputTarget.type == "checkbox") {
|
|
93
|
-
return this.inputTarget.checked ? "true" : "false"
|
|
103
|
+
return this.inputTarget.checked ? "true" : "false";
|
|
94
104
|
} else if (this.inputTarget.tagName == "SELECT" && this.data.get("attr")) {
|
|
95
|
-
let option = this.inputTarget.options[this.inputTarget.selectedIndex]
|
|
96
|
-
return option?.getAttribute(this.data.get("attr"))
|
|
105
|
+
let option = this.inputTarget.options[this.inputTarget.selectedIndex];
|
|
106
|
+
return option?.getAttribute(this.data.get("attr"));
|
|
97
107
|
} else {
|
|
98
|
-
return this.inputTarget.value
|
|
108
|
+
return this.inputTarget.value;
|
|
99
109
|
}
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
setUniqueId(node) {
|
|
113
|
+
if (typeof node.getAttribute != "function") return;
|
|
103
114
|
if (node.getAttribute("data-toggleable-node-id")) return;
|
|
104
115
|
const dateString = Date.now().toString(36);
|
|
105
116
|
const randomness = Math.random().toString(36).substring(2);
|
|
106
|
-
node.setAttribute("data-toggleable-node-id", dateString + randomness)
|
|
117
|
+
node.setAttribute("data-toggleable-node-id", dateString + randomness);
|
|
107
118
|
}
|
|
108
119
|
}
|
|
@@ -24,8 +24,7 @@ module Satis
|
|
|
24
24
|
#
|
|
25
25
|
def ct(key = nil, **options)
|
|
26
26
|
key = "#{full_i18n_scope(options).join('.')}#{key}" if key.start_with?('.')
|
|
27
|
-
|
|
28
|
-
original_view_context.t(key, **options)
|
|
27
|
+
original_view_context.controller.t(key, **options)
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def full_i18n_scope(options = {})
|
|
@@ -41,12 +40,8 @@ module Satis
|
|
|
41
40
|
@full_i18n_scope
|
|
42
41
|
end
|
|
43
42
|
|
|
44
|
-
def original_virtual_path
|
|
45
|
-
original_view_context.instance_variable_get(:@virtual_path)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
43
|
def original_i18n_scope
|
|
49
|
-
|
|
44
|
+
[original_view_context.controller_path.tr("/", "."), original_view_context.action_name]
|
|
50
45
|
end
|
|
51
46
|
|
|
52
47
|
def i18n_scope
|
|
@@ -55,4 +50,4 @@ module Satis
|
|
|
55
50
|
end
|
|
56
51
|
end
|
|
57
52
|
end
|
|
58
|
-
end
|
|
53
|
+
end
|
data/lib/satis/version.rb
CHANGED
data/mise.toml
ADDED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: satis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.
|
|
4
|
+
version: 2.4.1
|
|
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: 2026-06-
|
|
11
|
+
date: 2026-06-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: browser
|
|
@@ -934,6 +934,7 @@ files:
|
|
|
934
934
|
- lib/satis/satisfied.rb
|
|
935
935
|
- lib/satis/version.rb
|
|
936
936
|
- lib/tasks/satis_tasks.rake
|
|
937
|
+
- mise.toml
|
|
937
938
|
- package.json
|
|
938
939
|
- satis.gemspec
|
|
939
940
|
- vendor/javascript/@codemirror--autocomplete.js
|