feat(admin): footer record actions, deletable flag, mail row states and diff styles
- FormView footer RecordActions when there is no preview; meta.deletable hides Delete - Partial fields reload after save and record actions; customized/outdated badges - .summer-diff kit and docs for codeeditor, mailpreview and footer actions Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -29,7 +29,9 @@ update:
|
||||
|
||||
On a create form Save follows `redirect` and Save and close follows `redirectClose`; on an update form Save stays on the record. The create form also has Create and new, which saves the record and opens an empty create form of the same controller, ignoring both redirects. The buttons answer Ctrl+S (Cmd+S on macOS), Ctrl+Enter and, on the create form, Ctrl+Shift+S.
|
||||
|
||||
An optional `recordActions` key lists the record actions the form offers, by the names the controller registers through `pact.HasAdminRecordActions`. It needs a `preview` block, because record actions are offered on the [preview screen](#preview-screen). The show response of a record then carries `meta.actions`: the declared actions the administrator may run and that apply to the record in its current state. See [Record actions](admin-controllers.md#record-actions).
|
||||
An optional `recordActions` key lists the record actions the form offers, by the names the controller registers through `pact.HasAdminRecordActions`. When the form has a `preview` block, those actions appear on the [preview screen](#preview-screen). When it has no preview, the update form footer shows them after Delete (outline buttons; a `danger` action uses the danger confirm). The show response of a record carries `meta.actions`: the declared actions the administrator may run and that apply to the record in its current state. See [Record actions](admin-controllers.md#record-actions).
|
||||
|
||||
`meta.deletable` on the show response hides Delete when it is `false`. When the key is absent, Delete behaves as before (`true`), so existing controllers are unchanged. After every successful save and record action, `type: partial` fields reload so status hints and diffs stay current.
|
||||
|
||||
## fields.yaml
|
||||
|
||||
@@ -107,12 +109,12 @@ for _, f := range form.Fields {
|
||||
| `repeater` | A list of rows, each with its own small form, stored as JSON in one column; see [Repeater](#repeater). |
|
||||
| `money` | An exact decimal amount with a currency suffix, never a float and never rounded; see [Money](#money). |
|
||||
| `taglist` | A list of tags edited as chips, stored as a JSON array or as one separator-joined string; see [Taglist](#taglist). |
|
||||
| `codeeditor` | A source editor for HTML, CSS or plain text (`language` required: `html`, `css` or `text`); optional `size` and `mailImages: true` for the mail image insert control. |
|
||||
| `colorpicker` | A `#rrggbb` colour (or empty); Winter's `availableColors` is not supported. Invalid colours are a 422 with `backend::lang.colorpicker.invalid`. |
|
||||
| `mailimage` | A single image chosen from the mail image library (stores a file id). Missing library images are a 422 with `backend::lang.mailimage.missing`. |
|
||||
| `mailpreview` | A valueless live preview control (`mode` required: `template`, `layout`, `partial` or `branding`); never bound or accepted in a save body. |
|
||||
| `codeeditor` | A CodeMirror 6 source editor for HTML, CSS or plain text (`language` required: `html`, `css` or `text`); optional `size` and `mailImages: true` for the mail image insert control. Tab leaves the editor; Mod+S / Mod+Enter still save. A load failure falls back to a monospace textarea. |
|
||||
| `colorpicker` | A `#rrggbb` colour (or empty) with a native swatch and hex text; Winter's `availableColors` is not supported. Invalid colours are a 422 with `backend::lang.colorpicker.invalid`. |
|
||||
| `mailimage` | A single image chosen from the mail image library (stores a file id or null). Missing library images show `backend::lang.mailimage.missing` in the admin and are a 422 on save. |
|
||||
| `mailpreview` | A valueless live preview control (`mode` required: `template`, `layout`, `partial` or `branding`); never bound or accepted in a save body. Renders the server HTML in a sandboxed iframe and can send a test to the signed-in administrator. |
|
||||
|
||||
The WinterCMS widgets that are not in this list (the code editor, the color picker, the media finder and the others) are not provided. A field with one of those types stops the start-up, unless a plugin registers that alias as its own field type: plugins add field types with a custom element and Go code that decides what is stored; see [Plugin field types](field-types.md).
|
||||
The WinterCMS widgets that are not in this list (the media finder and the others) are not provided. A field with one of those types stops the start-up, unless a plugin registers that alias as its own field type: plugins add field types with a custom element and Go code that decides what is stored; see [Plugin field types](field-types.md).
|
||||
|
||||
### Field options
|
||||
|
||||
|
||||
Reference in New Issue
Block a user