forked from fa/breadcrumb-the-shire
feat(helpdesk): add user-select to schema editor field type dropdown
Adds 'user-select' to FIELD_TYPES so it appears in the schema editor dropdown as 'Benutzerauswahl' / 'User selection'. Preview renders a placeholder select. Translations added to both i18n files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -403,6 +403,7 @@
|
||||
"Date": "Datum",
|
||||
"Checkbox": "Checkbox",
|
||||
"Select": "Auswahl",
|
||||
"User selection": "Benutzerauswahl",
|
||||
"Text content": "Textinhalt",
|
||||
"Maximum %d fields allowed": "Maximal %d Felder erlaubt",
|
||||
"Field %d: unknown type \"%s\"": "Feld %d: unbekannter Typ \"%s\"",
|
||||
|
||||
@@ -403,6 +403,7 @@
|
||||
"Date": "Date",
|
||||
"Checkbox": "Checkbox",
|
||||
"Select": "Select",
|
||||
"User selection": "User selection",
|
||||
"Text content": "Text content",
|
||||
"Maximum %d fields allowed": "Maximum %d fields allowed",
|
||||
"Field %d: unknown type \"%s\"": "Field %d: unknown type \"%s\"",
|
||||
|
||||
@@ -53,6 +53,7 @@ $handoverSchemaFields = is_array($handoverSchemaFields ?? null) ? $handoverSchem
|
||||
'type_date' => t('Date'),
|
||||
'type_checkbox' => t('Checkbox'),
|
||||
'type_select' => t('Select'),
|
||||
'type_user-select' => t('User selection'),
|
||||
'text_content' => t('Text content'),
|
||||
'field' => t('Field'),
|
||||
'preview' => t('Preview'),
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
import { resolveHost } from '/js/core/app-dom.js';
|
||||
|
||||
const FIELD_TYPES = ['heading', 'paragraph', 'text', 'textarea', 'number', 'date', 'checkbox', 'select'];
|
||||
const FIELD_TYPES = ['heading', 'paragraph', 'text', 'textarea', 'number', 'date', 'checkbox', 'select', 'user-select'];
|
||||
const DISPLAY_ONLY_TYPES = ['heading', 'paragraph'];
|
||||
const EMPTY_API = Object.freeze({ destroy: () => {} });
|
||||
|
||||
@@ -385,6 +385,12 @@ function init(root) {
|
||||
option.textContent = opt.label || '';
|
||||
input.appendChild(option);
|
||||
});
|
||||
} else if (field.type === 'user-select') {
|
||||
input = document.createElement('select');
|
||||
const placeholder = document.createElement('option');
|
||||
placeholder.value = '';
|
||||
placeholder.textContent = t['type_user-select'] || 'User selection';
|
||||
input.appendChild(placeholder);
|
||||
} else {
|
||||
input = document.createElement('input');
|
||||
input.type = field.type === 'number' ? 'number' : field.type === 'date' ? 'date' : 'text';
|
||||
|
||||
Reference in New Issue
Block a user