diff --git a/js/src/admin/components/FieldEdit.js b/js/src/admin/components/FieldEdit.js
index 707482b..6edcf21 100644
--- a/js/src/admin/components/FieldEdit.js
+++ b/js/src/admin/components/FieldEdit.js
@@ -12,145 +12,112 @@ export default class FieldEdit {
const { field, loading, onUpdate } = vnode.attrs;
const exists = field.id();
- return m(
- 'fieldset.Field',
- {
- 'data-id': field.id(),
- key: field.id(),
- },
- [
- m('legend', [
- exists
- ? [
- Button.component({
- className: 'Button Button--icon Button--danger',
- icon: 'fas fa-trash',
- onclick: () => this.deleteField(field, onUpdate),
- }),
- ' ',
- ]
- : null,
- m(
- 'span.Field-toggle',
- {
- onclick: (e) => this.toggleField(e),
- },
- [
- app.translator.trans('fof-masquerade.admin.fields.' + (exists ? 'edit' : 'add'), {
- field: field.name(),
- }),
- ' ',
- icon('fas fa-caret-down'),
- ]
- ),
- ]),
- m('.Field-body', [this.fieldItems(field).toArray()]),
- ]
+ return (
+
);
}
- fieldItems(field) {
+ fieldItems(field, onUpdate) {
const fields = new ItemList();
fields.add(
'name',
- m('.Form-group', [
- m('label', app.translator.trans('fof-masquerade.admin.fields.name')),
- m('input.FormControl', {
- value: field.name(),
- oninput: withAttr('value', this.updateExistingFieldInput.bind(this, 'name', field)),
- }),
- m('span.helpText', app.translator.trans('fof-masquerade.admin.fields.name-help')),
- ]),
+
+
+
+ {app.translator.trans('fof-masquerade.admin.fields.name-help')}
+
,
100
);
fields.add(
'description',
- m('.Form-group', [
- m('label', app.translator.trans('fof-masquerade.admin.fields.description')),
- m('input.FormControl', {
- value: field.description(),
- oninput: withAttr('value', this.updateExistingFieldInput.bind(this, 'description', field)),
- }),
- m('span.helpText', app.translator.trans('fof-masquerade.admin.fields.description-help')),
- ]),
+
+
+
+ {app.translator.trans('fof-masquerade.admin.fields.description-help')}
+
,
90
);
fields.add(
'icon',
- m('.Form-group', [
- m('label', app.translator.trans('fof-masquerade.admin.fields.icon')),
- m('input.FormControl', {
- value: field.icon(),
- oninput: withAttr('value', this.updateExistingFieldInput.bind(this, 'icon', field)),
- }),
- m(
- 'span.helpText',
- app.translator.trans('fof-masquerade.admin.fields.icon-help', {
+
+
+
+
+ {app.translator.trans('fof-masquerade.admin.fields.icon-help', {
a: ,
- })
- ),
- ]),
+ })}
+
+
,
80
);
fields.add(
'on_bio',
- m('.Form-group', [
- Switch.component(
- {
- state: field.on_bio(),
- onchange: this.updateExistingFieldInput.bind(this, 'on_bio', field),
- },
- app.translator.trans('fof-masquerade.admin.fields.on_bio')
- ),
- ]),
+
+
+ {app.translator.trans('fof-masquerade.admin.fields.on_bio')}
+
+
,
70
);
fields.add(
'required',
- m('.Form-group', [
- Switch.component(
- {
- state: field.required(),
- onchange: this.updateExistingFieldInput.bind(this, 'required', field),
- },
- app.translator.trans('fof-masquerade.admin.fields.required')
- ),
- ]),
+
+
+ {app.translator.trans('fof-masquerade.admin.fields.required')}
+
+
,
60
);
fields.add(
'type',
- m('.Form-group', [
- m('label', app.translator.trans('fof-masquerade.admin.fields.type')),
- Select.component({
- onchange: (value) => {
+
+
+
,
50
);
if (field.type() === 'select') {
fields.add(
'select_options',
- SelectFieldOptionEditor.component({
- onchange: (value) => {
+ {
this.updateExistingFieldInput('validation', field, value);
- },
- value: field.validation(),
- }),
+ }}
+ value={field.validation()}
+ />,
40
);
}
@@ -158,48 +125,42 @@ export default class FieldEdit {
if (field.type() === null) {
fields.add(
'validation',
- m('.Form-group', [
- m('label', app.translator.trans('fof-masquerade.admin.fields.validation')),
- m('input.FormControl', {
- value: field.validation(),
- oninput: withAttr('value', this.updateExistingFieldInput.bind(this, 'validation', field)),
- }),
- m(
- 'span.helpText',
- app.translator.trans('fof-masquerade.admin.fields.validation-help', {
+
+
+
+
+ {app.translator.trans('fof-masquerade.admin.fields.validation-help', {
a: ,
- })
- ),
- ]),
+ })}
+
+
,
30
);
}
fields.add(
'actions',
- m('.Form-group', [
- m('.ButtonGroup', [
- Button.component(
- {
- className: 'Button Button--primary',
- loading: this.loading,
- disabled: !this.readyToAdd(field),
- onclick: field.id() ? this.updateExistingField.bind(this, field, this.onUpdate) : this.submitAddField.bind(this, field, this.onUpdate),
- },
- app.translator.trans('fof-masquerade.admin.buttons.' + (field.id() ? 'edit' : 'add') + '-field')
- ),
- field.id()
- ? Button.component(
- {
- className: 'Button Button--danger',
- loading: this.loading,
- onclick: this.deleteField.bind(this, field, this.onUpdate),
- },
- app.translator.trans('fof-masquerade.admin.buttons.delete-field')
- )
- : null,
- ]),
- ]),
+
+
+
+ {field.id() ? (
+
+ ) : null}
+
+
,
20
);