feat(32-01): form extension placement rules, boot errors and owner-aware branches
- placement: tabs before/after tab anchors, anchor cursor for plugin order, own-field anchors sorted with cycle detection, Requires() rule, anchor tab inheritance, Hide with reference checks, zone refusal (D-101) - boot errors name plugin, controller and offending name; fileupload is refused (D-100); localized tab label collisions checked in Activate - extension widgets dispatch to AdminFormExtension.Actions, partials render from the contributor's Dir through PartialData, plugin field types decode for Save and load after Load, translatable values reach Save as locale maps and never the owner's translations - Permissions and Visible apply to schema, show, save, widgets and partials; AdminFormErrors answer 422, Save notices join meta.notices
This commit is contained in:
@@ -464,6 +464,12 @@ const (
|
||||
// boot. Set at most one of them; an extension with neither adds no field and
|
||||
// may still hide owner fields and run Load and Save.
|
||||
//
|
||||
// An extension adds value fields (text, textarea, number, checkbox, switch,
|
||||
// dropdown with listed options, markdown, mltext, mltextarea, mlmarkdown and
|
||||
// plugin field types), widget fields and partial fields; types that bind to
|
||||
// the owner's model (fileupload, relation, repeater and the like) are
|
||||
// refused, and an extension with value fields needs Save.
|
||||
//
|
||||
// Placement: a field goes Before or After its anchor field, or to the end of
|
||||
// its tab without one; a field without tab: takes its anchor's tab. A new tab
|
||||
// goes Before or After its anchor tab, or after the last tab without one;
|
||||
@@ -535,8 +541,12 @@ type AdminFormLoad struct {
|
||||
// record's save transaction (cabana.TxFromContext reads it too); the owner row
|
||||
// is already written, so Record carries its primary key, also given as ID.
|
||||
// Created is true on create. Values are the submitted values of the
|
||||
// extension's fields whose context allows the operation, keyed by field name;
|
||||
// a field the request did not send is absent.
|
||||
// extension's value fields whose context allows the operation, keyed by field
|
||||
// name; a field the request did not send is absent. A value is as decoded from
|
||||
// the JSON body (numbers as json.Number), a translatable field's a
|
||||
// map[string]string of locale to text, a plugin field type's the value its
|
||||
// Decode returned. Save runs on every create and update of a record whose
|
||||
// administrator sees the extension, with or without values.
|
||||
type AdminFormSave struct {
|
||||
DB *gorm.DB
|
||||
Controller string
|
||||
|
||||
Reference in New Issue
Block a user