plutonium 0.24.6 → 0.25.0
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/assets/plutonium.css +2 -2
- data/app/assets/plutonium.js +16 -0
- data/app/assets/plutonium.js.map +3 -3
- data/app/assets/plutonium.min.js +28 -28
- data/app/assets/plutonium.min.js.map +4 -4
- data/lib/plutonium/action/interactive.rb +1 -0
- data/lib/plutonium/helpers/turbo_helper.rb +2 -2
- data/lib/plutonium/resource/controllers/interactive_actions.rb +13 -13
- data/lib/plutonium/ui/action_button.rb +7 -1
- data/lib/plutonium/ui/form/base.rb +1 -1
- data/lib/plutonium/ui/layout/base.rb +2 -0
- data/lib/plutonium/ui/page/interactive_action.rb +21 -1
- data/lib/plutonium/version.rb +1 -1
- data/package.json +1 -1
- data/src/js/controllers/register_controllers.js +2 -0
- data/src/js/controllers/remote_modal_controller.js +24 -0
- metadata +3 -2
@@ -27,7 +27,7 @@ module Plutonium
|
|
27
27
|
def interactive_record_action
|
28
28
|
build_interactive_record_action_interaction
|
29
29
|
|
30
|
-
if helpers.current_turbo_frame == "
|
30
|
+
if helpers.current_turbo_frame == "remote_modal"
|
31
31
|
render layout: false
|
32
32
|
else
|
33
33
|
render :interactive_record_action
|
@@ -52,11 +52,11 @@ module Plutonium
|
|
52
52
|
outcome.to_response.process(self) do |value|
|
53
53
|
respond_to do |format|
|
54
54
|
if outcome.success?
|
55
|
-
return_url = redirect_url_after_action_on(
|
55
|
+
return_url = redirect_url_after_action_on(resource_record!)
|
56
56
|
|
57
57
|
format.any { redirect_to return_url, status: :see_other }
|
58
58
|
|
59
|
-
if helpers.current_turbo_frame == "
|
59
|
+
if helpers.current_turbo_frame == "remote_modal"
|
60
60
|
format.turbo_stream do
|
61
61
|
render turbo_stream: [
|
62
62
|
turbo_stream.redirect(return_url)
|
@@ -73,10 +73,10 @@ module Plutonium
|
|
73
73
|
render "errors", status: :unprocessable_entity
|
74
74
|
end
|
75
75
|
|
76
|
-
if helpers.current_turbo_frame == "
|
76
|
+
if helpers.current_turbo_frame == "remote_modal"
|
77
77
|
format.turbo_stream do
|
78
78
|
render turbo_stream: [
|
79
|
-
turbo_stream.replace(:
|
79
|
+
turbo_stream.replace(:remote_modal, partial: "interactive_action_form")
|
80
80
|
]
|
81
81
|
end
|
82
82
|
end
|
@@ -90,7 +90,7 @@ module Plutonium
|
|
90
90
|
skip_verify_current_authorized_scope!
|
91
91
|
build_interactive_resource_action_interaction
|
92
92
|
|
93
|
-
if helpers.current_turbo_frame == "
|
93
|
+
if helpers.current_turbo_frame == "remote_modal"
|
94
94
|
render layout: false
|
95
95
|
else
|
96
96
|
render :interactive_resource_action
|
@@ -120,7 +120,7 @@ module Plutonium
|
|
120
120
|
|
121
121
|
format.any { redirect_to return_url, status: :see_other }
|
122
122
|
|
123
|
-
if helpers.current_turbo_frame == "
|
123
|
+
if helpers.current_turbo_frame == "remote_modal"
|
124
124
|
format.turbo_stream do
|
125
125
|
render turbo_stream: [
|
126
126
|
turbo_stream.redirect(return_url)
|
@@ -137,10 +137,10 @@ module Plutonium
|
|
137
137
|
render "errors", status: :unprocessable_entity
|
138
138
|
end
|
139
139
|
|
140
|
-
if helpers.current_turbo_frame == "
|
140
|
+
if helpers.current_turbo_frame == "remote_modal"
|
141
141
|
format.turbo_stream do
|
142
142
|
render turbo_stream: [
|
143
|
-
turbo_stream.replace(:
|
143
|
+
turbo_stream.replace(:remote_modal, partial: "interactive_action_form")
|
144
144
|
]
|
145
145
|
end
|
146
146
|
end
|
@@ -156,7 +156,7 @@ module Plutonium
|
|
156
156
|
# interactive_bulk
|
157
157
|
# @interaction = current_interactive_action.interaction.new((params[:interaction] || {}).except(:resources))
|
158
158
|
|
159
|
-
# if helpers.current_turbo_frame == "
|
159
|
+
# if helpers.current_turbo_frame == "remote_modal"
|
160
160
|
# render layout: false
|
161
161
|
# else
|
162
162
|
# render :interactive_bulk_action
|
@@ -176,7 +176,7 @@ module Plutonium
|
|
176
176
|
# flash[:notice] = "TODO:#{current_interactive_action} #{collection_count} #{resource_class.model_name.human.pluralize(collection_count)} successfully updated."
|
177
177
|
|
178
178
|
# format.html { redirect_to resource_url_for(resource_class) }
|
179
|
-
# if helpers.current_turbo_frame == "
|
179
|
+
# if helpers.current_turbo_frame == "remote_modal"
|
180
180
|
# format.turbo_stream do
|
181
181
|
# render turbo_stream: [
|
182
182
|
# turbo_stream.redirect(resource_url_for(resource_class))
|
@@ -192,9 +192,9 @@ module Plutonium
|
|
192
192
|
# render "errors", status: :unprocessable_entity
|
193
193
|
# end
|
194
194
|
|
195
|
-
# if helpers.current_turbo_frame == "
|
195
|
+
# if helpers.current_turbo_frame == "remote_modal"
|
196
196
|
# format.turbo_stream do
|
197
|
-
# render turbo_stream: turbo_stream.replace(:
|
197
|
+
# render turbo_stream: turbo_stream.replace(:remote_modal, partial: "interactive_bulk_action_form")
|
198
198
|
# end
|
199
199
|
# end
|
200
200
|
# end
|
@@ -23,8 +23,14 @@ module Plutonium
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def render_link
|
26
|
+
uri = URI.parse(@url)
|
27
|
+
params = Rack::Utils.parse_nested_query(uri.query)
|
28
|
+
params["return_to"] = request.original_url
|
29
|
+
uri.query = params.to_query
|
30
|
+
uri.to_s
|
31
|
+
|
26
32
|
link_to(
|
27
|
-
|
33
|
+
uri.to_s,
|
28
34
|
class: button_classes,
|
29
35
|
data: {turbo_frame: @action.turbo_frame}
|
30
36
|
) do
|
@@ -61,7 +61,7 @@ module Plutonium
|
|
61
61
|
private
|
62
62
|
|
63
63
|
def render_actions
|
64
|
-
input name:
|
64
|
+
input name: "return_to", value: request.params[:return_to], type: :hidden, hidden: true
|
65
65
|
|
66
66
|
actions_wrapper {
|
67
67
|
render submit_button
|
@@ -8,6 +8,7 @@ module Plutonium
|
|
8
8
|
include Phlex::Rails::Helpers::FaviconLinkTag
|
9
9
|
include Phlex::Rails::Helpers::StylesheetLinkTag
|
10
10
|
include Phlex::Rails::Helpers::JavascriptIncludeTag
|
11
|
+
include Phlex::Rails::Helpers::TurboFrameTag
|
11
12
|
|
12
13
|
def view_template(&)
|
13
14
|
doctype
|
@@ -66,6 +67,7 @@ module Plutonium
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def render_after_main
|
70
|
+
turbo_frame_tag("remote_modal")
|
69
71
|
end
|
70
72
|
|
71
73
|
def render_content(&)
|
@@ -4,6 +4,8 @@ module Plutonium
|
|
4
4
|
module UI
|
5
5
|
module Page
|
6
6
|
class InteractiveAction < Base
|
7
|
+
include Phlex::Rails::Helpers::TurboFrameTag
|
8
|
+
|
7
9
|
private
|
8
10
|
|
9
11
|
def page_title
|
@@ -15,7 +17,25 @@ module Plutonium
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def render_default_content
|
18
|
-
|
20
|
+
if helpers.current_turbo_frame == "remote_modal"
|
21
|
+
dialog(
|
22
|
+
closedby: "any",
|
23
|
+
class:
|
24
|
+
"rounded-md w-full max-w-3xl
|
25
|
+
backdrop:bg-black/60 backdrop:backdrop-blur-sm
|
26
|
+
top-auto md:top-1/2 md:-translate-y-1/2 left-1/2 -translate-x-1/2
|
27
|
+
max-h-[80%] p-6
|
28
|
+
hidden open:flex flex-col
|
29
|
+
relative opacity-0 open:opacity-100
|
30
|
+
transition-opacity duration-300 ease-in-out",
|
31
|
+
data: {controller: "remote-modal"}
|
32
|
+
) do
|
33
|
+
render_page_header
|
34
|
+
render partial("interactive_action_form")
|
35
|
+
end
|
36
|
+
else
|
37
|
+
render partial("interactive_action_form")
|
38
|
+
end
|
19
39
|
end
|
20
40
|
|
21
41
|
def page_type = :interactive_action_page
|
data/lib/plutonium/version.rb
CHANGED
data/package.json
CHANGED
@@ -18,6 +18,7 @@ import AttachmentPreviewController from "./attachment_preview_controller.js"
|
|
18
18
|
import AttachmentPreviewContainerController from "./attachment_preview_container_controller.js"
|
19
19
|
import SidebarController from "./sidebar_controller.js"
|
20
20
|
import PasswordVisibilityController from "./password_visibility_controller.js"
|
21
|
+
import RemoteModalController from "./remote_modal_controller.js"
|
21
22
|
|
22
23
|
export default function (application) {
|
23
24
|
// Register controllers here
|
@@ -40,4 +41,5 @@ export default function (application) {
|
|
40
41
|
application.register("attachment-input", AttachmentInputController)
|
41
42
|
application.register("attachment-preview", AttachmentPreviewController)
|
42
43
|
application.register("attachment-preview-container", AttachmentPreviewContainerController)
|
44
|
+
application.register("remote-modal", RemoteModalController)
|
43
45
|
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
2
|
+
|
3
|
+
// Connects to data-controller="remote-modal"
|
4
|
+
export default class extends Controller {
|
5
|
+
connect() {
|
6
|
+
// Store original scroll position
|
7
|
+
this.originalScrollPosition = window.scrollY;
|
8
|
+
|
9
|
+
// Show the modal
|
10
|
+
this.element.showModal();
|
11
|
+
// Add close event listener
|
12
|
+
this.element.addEventListener('close', this.handleClose.bind(this));
|
13
|
+
}
|
14
|
+
|
15
|
+
disconnect() {
|
16
|
+
// Clean up event listener when controller is disconnected
|
17
|
+
this.element.removeEventListener('close', this.handleClose);
|
18
|
+
}
|
19
|
+
|
20
|
+
handleClose() {
|
21
|
+
// Restore the original scroll position after dialog closes
|
22
|
+
window.scrollTo(0, this.originalScrollPosition);
|
23
|
+
}
|
24
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plutonium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Froelich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -911,6 +911,7 @@ files:
|
|
911
911
|
- src/js/controllers/nested_resource_form_fields_controller.js
|
912
912
|
- src/js/controllers/password_visibility_controller.js
|
913
913
|
- src/js/controllers/register_controllers.js
|
914
|
+
- src/js/controllers/remote_modal_controller.js
|
914
915
|
- src/js/controllers/resource_collapse_controller.js
|
915
916
|
- src/js/controllers/resource_dismiss_controller.js
|
916
917
|
- src/js/controllers/resource_drop_down_controller.js
|