You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/generators/rolemodel/modals/README.md
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,12 @@
8
8
* frame-missing handler (required for turbo-rails v1.4.0 and above)
9
9
* a very simple stimulus controller `toggle` to help with modal/panel animations.
10
10
11
+
## After install (Update Only)
12
+
13
+
1. This generator does not currently attempt to remove the old RoleModel Modal/Confirm/Panel or MakeFormsRemote javascript files or initialization code. However, that code needs to be removed for the new process to work correctly.
14
+
2. Remove Rails-UJS from your project. Most likely that means running `yarn remove @rails/ujs` and then deleting the `import` and `start()` statements from application.js.
15
+
3. Ensure your application layout now includes the *empty*`turbo_frame_tag`s for `modal` & `panel` as well as the new confirm partial. The generator should have done this but it may have failed if your layout is much different than expected.
16
+
11
17
## Turbo confirm example
12
18
13
19
```slim
@@ -72,7 +78,7 @@ class SomethingsController < ApplicationController
72
78
end
73
79
```
74
80
75
-
## Layout Content Slots
81
+
## Modal header & footer
76
82
77
83
The included modal layout includes *slots* for title content & submit buttons, in addition to the main content `yield`. You may, of course remove these sections if they don't match your use-case. Otherwise, the following is an example edit template meant to be rendered in the modal layout.
78
84
@@ -88,4 +94,17 @@ The included modal layout includes *slots* for title content & submit buttons, i
88
94
= f.input :description
89
95
```
90
96
91
-
__note:__ the submit button in the `new.html.slim` version of this template would be `form: dom_id(@thing)` or simply `form: 'new_thing'`. For further explanation of form Id generation, see the [polymorphic_path docs](https://api.rubyonrails.org/classes/ActionDispatch/Routing/PolymorphicRoutes.html) or simply inspect the form element in your browser.
97
+
__note:__ the submit button in the `new.html.slim` version of this template would be `form: dom_id(@thing)` or simply `form: 'new_thing'`.
98
+
99
+
Alternatively, it's still possible to nest the `content_for` block within the form builder if you need to leverege button text generation, for example. Though you __must__ still set the `form` attribute explicitly, because the button (or `input[type='submit']` in this case) will ultimately be rendered outside of the `<form></form>` tags. e.g.
100
+
101
+
```slim
102
+
= simple_form_for @thing do |f|
103
+
= f.input :name
104
+
= f.input :description
105
+
106
+
= content_for :modal_actions do
107
+
= f.submit form: f.id
108
+
```
109
+
110
+
For further explanation of form Id generation, see the [Record Identifier](https://api.rubyonrails.org/classes/ActionView/RecordIdentifier.html) and [polymorphic Routes](https://api.rubyonrails.org/classes/ActionDispatch/Routing/PolymorphicRoutes.html) docs, or simply inspect the form element in your browser.
0 commit comments