rails-active-ui 0.3.1 → 0.3.2
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/javascript/ui/controllers/turbo_modal_controller.js +36 -0
- data/config/importmap.rb +1 -0
- data/lib/ui/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6cbe21a483e19cb15cc49eefc1fd114564336f3e29d7d3db70fd6b4c9281d741
|
|
4
|
+
data.tar.gz: 3271b641df24f58bf5f777332d91e49879e38121cbe6b0f62e5548e9711e3d67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01a0bf819c02d0bd144398dfd279868115fd4173845bab08dd507b931eddd62731d6562fba12408c54a4e2fdea0a0fb8e1cd2b95c394a0ab1e558950cfdcdfba
|
|
7
|
+
data.tar.gz: 7a801b7b98932d713f9932528085a95eee4fd2ca1d50e6749b365ea17f53156cc005c7cb529069ce0eb46b2055891cb11f534810fe659c5bba7344a1d897f193
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Bridges Turbo Frame events to the Fomantic-UI modal.
|
|
4
|
+
//
|
|
5
|
+
// Used alongside fui-modal on a Modal(turbo: true) element.
|
|
6
|
+
// - turbo:frame-load -> open() (content arrived, show modal)
|
|
7
|
+
// - turbo:submit-end -> closeOnSuccess() (form submitted, hide if ok)
|
|
8
|
+
// - click cancel -> hide() (dismiss without submitting)
|
|
9
|
+
//
|
|
10
|
+
// The fui-modal controller handles Fomantic-UI init and settings.
|
|
11
|
+
// This controller only handles the Turbo lifecycle + cancel.
|
|
12
|
+
|
|
13
|
+
export default class extends Controller {
|
|
14
|
+
connect() {
|
|
15
|
+
// Clear turbo frame content when the modal finishes hiding,
|
|
16
|
+
// so it's clean for the next open.
|
|
17
|
+
$(this.element).modal("setting", "onHidden", () => {
|
|
18
|
+
const frame = this.element.querySelector("turbo-frame")
|
|
19
|
+
if (frame) frame.innerHTML = ""
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
open() {
|
|
24
|
+
$(this.element).modal("show")
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
hide() {
|
|
28
|
+
$(this.element).modal("hide")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
closeOnSuccess(event) {
|
|
32
|
+
if (event.detail.success) {
|
|
33
|
+
$(this.element).modal("hide")
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
data/config/importmap.rb
CHANGED
|
@@ -29,5 +29,6 @@ pin "ui/controllers/fui_emoji_picker_controller", to: "ui/controllers/fui_emoji_
|
|
|
29
29
|
pin "ui/controllers/fui_datatable_controller", to: "ui/controllers/fui_datatable_controller.js"
|
|
30
30
|
pin "ui/controllers/fui_item_list_controller", to: "ui/controllers/fui_item_list_controller.js"
|
|
31
31
|
pin "ui/controllers/navigation_controller", to: "ui/controllers/navigation_controller.js"
|
|
32
|
+
pin "ui/controllers/turbo_modal_controller", to: "ui/controllers/turbo_modal_controller.js"
|
|
32
33
|
|
|
33
34
|
pin "emoji-picker-element", to: "https://cdn.jsdelivr.net/npm/emoji-picker-element@^1/index.js"
|
data/lib/ui/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails-active-ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nathan
|
|
@@ -204,6 +204,7 @@ files:
|
|
|
204
204
|
- app/javascript/ui/controllers/fui_transition_controller.js
|
|
205
205
|
- app/javascript/ui/controllers/fui_visibility_controller.js
|
|
206
206
|
- app/javascript/ui/controllers/navigation_controller.js
|
|
207
|
+
- app/javascript/ui/controllers/turbo_modal_controller.js
|
|
207
208
|
- app/javascript/ui/index.js
|
|
208
209
|
- app/javascript/visibility.js
|
|
209
210
|
- app/javascript/visibility.min.js
|