mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2026-03-13 10:32:25 +08:00
error pages
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsoneditor@9.4.0/dist/jsoneditor.min.css">
|
||||
<div class="form-label">{{ label }}</div>
|
||||
<div id="{{ name }}" class="form-group mb-3"></div>
|
||||
<input {% if not null %}required{% endif %} type="text" name="{{ name }}" value='{{ value|safe }}' hidden>
|
||||
<input {% if not null %}required{% endif %} type="text" name="{{ name }}" value="{{ value|safe }}" hidden>
|
||||
<style>
|
||||
.jsoneditor {
|
||||
border: 1px solid #dadcde;
|
||||
@@ -21,12 +21,15 @@
|
||||
let options = {{options|safe}};
|
||||
if (Object.keys(options).length === 0) {
|
||||
options = {
|
||||
modes: ['tree', 'view', 'form', 'code', 'text', 'preview']
|
||||
modes: ['tree', 'view', 'form', 'code', 'text', 'preview'],
|
||||
}
|
||||
}
|
||||
options.onChangeText = function (json) {
|
||||
$('input[name={{ name }}]').val(json);
|
||||
}
|
||||
const editor = new JSONEditor(container, options)
|
||||
editor.set({{ value|safe }})
|
||||
{% if value %}
|
||||
editor.set({{ value|safe }})
|
||||
{% endif %}
|
||||
editor.expandAll();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user