--- /dev/null
+{% extends "master.html" %}
+{% block head %}
+ <meta charset="utf-8" />
+ <title>{% block title %}JSON Editor{% endblock %}</title>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
+ <meta name="robots" content="noindex, nofollow" />
+ <link rel="shortcut icon" href="{{url_for('static', filename='favicon.png')}}" />
+ <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
+ <link rel="stylesheet" type="text/css" media="screen" href="{{url_for('static', filename='style.css')}}" />
+{% endblock %}
+
+{% block content %}
+<div id='editor_holder'></div>
+<button id='submit'>Submit (console.log)</button>
+
+<script>
+ JSONEditor.defaults.options = {simplemde: {spellChecker: false}};
+ JSONEditor.defaults.languages.de = {
+ error_notset: 'Eigenschaft ist nicht gesetzt',
+ error_notempty: 'Wert erforderlich',
+ error_enum: 'Wert muss einem der vorgegebenen entsprechen',
+ error_anyOf: 'Wert muss mindestens nach einem der vorgegebenen Schemas gültig sein',
+ error_oneOf: 'Wert muss genau einem der vorgegebenen Schemas entsprechen. Derzeit ist es nach {{0}} Schemas gültig.',
+ error_not: 'Wert darf nach dem vorgegebenen Schema nicht gültig sein',
+ error_type_union: 'Wert muss einer der vorgegebenen Typen entsprechen',
+ error_type: 'Wert muss vom Typ {{0}} sein',
+ error_disallow_union: 'Wert darf nicht einer der vorgegebenen unerlaubten Typen sein',
+ error_disallow: 'Wert darf nicht vom Typ {{0}} sein',
+ error_multipleOf: 'Wert muss das vielfache von {{0}} sein',
+ error_maximum_excl: 'Wert muss kleiner sein als {{0}}',
+ error_maximum_incl: 'Wert darf maximal {{0}} sein',
+ error_minimum_excl: 'Wert muss größer sein als {{0}}',
+ error_minimum_incl: 'Wert muss mindestens {{0}} sein',
+ error_maxLength: 'Wert darf maximal {{0}} Zeichen lang sein',
+ error_minLength: 'Wert muss mindestens {{0}} Zeichen lang sein',
+ error_pattern: 'Wert muss dem vorgegebenen Muster {{0}} entsprechen',
+ error_additionalItems: 'In der Liste sind keine zusätzlichen Einträge erlaubt',
+ /**
+ * When there are to many items in an array
+ * @variables This key takes one variable: The maximum item count
+ */
+ error_maxItems: 'Value must have at most {{0}} items',
+ /**
+ * When there are not enough items in an array
+ * @variables This key takes one variable: The minimum item count
+ */
+ error_minItems: 'Value must have at least {{0}} items',
+ /**
+ * When an array is supposed to have unique items but has duplicates
+ */
+ error_uniqueItems: 'Array must have unique items',
+ /**
+ * When there are too many properties in an object
+ * @variables This key takes one variable: The maximum property count
+ */
+ error_maxProperties: 'Object must have at most {{0}} properties',
+ /**
+ * When there are not enough properties in an object
+ * @variables This key takes one variable: The minimum property count
+ */
+ error_minProperties: 'Object must have at least {{0}} properties',
+ /**
+ * When a required property is not defined
+ * @variables This key takes one variable: The name of the missing property
+ */
+ error_required: "Object is missing the required property '{{0}}'",
+ /**
+ * When there is an additional property is set whereas there should be none
+ * @variables This key takes one variable: The name of the additional property
+ */
+ error_additional_properties: 'No additional properties allowed, but property {{0}} is set',
+ /**
+ * When there is a propertyName that sets a max length and a property name exceeds the max length
+ * @variables This key takes one variable: The name of the invalid property
+ */
+ error_property_names_exceeds_maxlength: 'Property name {{0}} exceeds maxLength',
+ /**
+ * When there is a propertyName that sets an enum and a property name matches none of the possible enum
+ * @variables This key takes one variable: The name of the invalid property
+ */
+ error_property_names_enum_mismatch: 'Property name {{0}} does not match any enum values',
+ /**
+ * When there is a propertyName that sets a pattern and a property name does not match the pattern
+ * @variables This key takes one variable: The name of the invalid property
+ */
+ error_property_names_pattern_mismatch: 'Property name {{0}} does not match pattern',
+ /**
+ * When the propertyName is set to false and there is at least one property
+ * @variables This key takes one variable: The name of the invalid property
+ */
+ error_property_names_false: 'Property name {{0}} fails when propertyName is false',
+ /**
+ * When the propertyName specifies a maxLength that is not a number
+ * @variables This key takes one variable: The name of the current property
+ */
+ error_property_names_maxlength: 'Property name {{0}} cannot match invalid maxLength',
+ /**
+ * When the propertyName specifies an enum that is not an array
+ * @variables This key takes one variable: The name of the current property
+ */
+ error_property_names_enum: 'Property name {{0}} cannot match invalid enum',
+ /**
+ * When the propertyName specifies a pattern that is not a string
+ * @variables This key takes one variable: The name of the current property
+ */
+ error_property_names_pattern: 'Property name {{0}} cannot match invalid pattern',
+ /**
+ * When the propertyName is unsupported
+ * @variables This key takes one variable: The name of the invalid propertyName
+ */
+ error_property_names_unsupported: 'Unsupported propertyName {{0}}',
+ /**
+ * When a dependency is not resolved
+ * @variables This key takes one variable: The name of the missing property for the dependency
+ */
+ error_dependency: 'Must have property {{0}}',
+ /**
+ * When a date is in incorrect format
+ * @variables This key takes one variable: The valid format
+ */
+ error_date: 'Date must be in the format {{0}}',
+ /**
+ * When a time is in incorrect format
+ * @variables This key takes one variable: The valid format
+ */
+ error_time: 'Time must be in the format {{0}}',
+ /**
+ * When a datetime-local is in incorrect format
+ * @variables This key takes one variable: The valid format
+ */
+ error_datetime_local: 'Datetime must be in the format {{0}}',
+ /**
+ * When a integer date is less than 1 January 1970
+ */
+ error_invalid_epoch: 'Date must be greater than 1 January 1970',
+ /**
+ * When an IPv4 is in incorrect format
+ */
+ error_ipv4: 'Value must be a valid IPv4 address in the form of 4 numbers between 0 and 255, separated by dots',
+ /**
+ * When an IPv6 is in incorrect format
+ */
+ error_ipv6: 'Value must be a valid IPv6 address',
+ /**
+ * When a hostname is in incorrect format
+ */
+ error_hostname: 'The hostname has the wrong format',
+ /**
+ * Text on Delete All buttons
+ */
+ button_delete_all: 'All',
+ /**
+ * Title on Delete All buttons
+ */
+ button_delete_all_title: 'Delete All',
+ /**
+ * Text on Delete Last buttons
+ * @variable This key takes one variable: The title of object to delete
+ */
+ button_delete_last: 'Last {{0}}',
+ /**
+ * Title on Delete Last buttons
+ * @variable This key takes one variable: The title of object to delete
+ */
+ button_delete_last_title: 'Delete Last {{0}}',
+ /**
+ * Title on Add Row buttons
+ * @variable This key takes one variable: The title of object to add
+ */
+ button_add_row_title: 'Add {{0}}',
+ /**
+ * Title on Move Down buttons
+ */
+ button_move_down_title: 'Move down',
+ /**
+ * Title on Move Up buttons
+ */
+ button_move_up_title: 'Move up',
+ /**
+ * Title on Object Properties buttons
+ */
+ button_object_properties: 'Object Properties',
+ /**
+ * Title on Delete Row buttons
+ * @variable This key takes one variable: The title of object to delete
+ */
+ button_delete_row_title: '{{0}} löschen',
+ /**
+ * Title on Delete Row buttons, short version (no parameter with the object title)
+ */
+ button_delete_row_title_short: 'Löschen',
+ /**
+ * Title on Copy Row buttons, short version (no parameter with the object title)
+ */
+ button_copy_row_title_short: 'Copy',
+ /**
+ * Title on Collapse buttons
+ */
+ button_collapse: 'Collapse',
+ /**
+ * Title on Expand buttons
+ */
+ button_expand: 'Expand',
+ /**
+ * Title on Flatpickr toggle buttons
+ */
+ flatpickr_toggle_button: 'Toggle',
+ /**
+ * Title on Flatpickr clear buttons
+ */
+ flatpickr_clear_button: 'Clear',
+ /**
+ * Choices input field placeholder text
+ */
+ choices_placeholder_text: 'Start typing to add value',
+ /**
+ * Default title for array items
+ */
+ default_array_item_title: 'item',
+ /**
+ * Warning when deleting a node
+ */
+ button_delete_node_warning: 'Are you sure you want to remove this node?'
+}
+
+
+
+
+
+ JSONEditor.defaults.language = "de";
+
+
+ // Initialize the editor with a JSON schema
+ var editor = new JSONEditor(document.getElementById('editor_holder'), {
+ // https://www.winterrodeln.org/mediawiki/index.php?title=Winterrodeln:Datenschema/Rodelbahn/V1.json&action=raw
+ schema: {"$ref": "{{schema_url}}"},
+ theme: 'bootstrap4',
+ ajax: true
+ });
+
+ editor.on('ready',() => {
+ // https://www.winterrodeln.org/mediawiki/index.php?title=Latschenh%C3%BCtte/Rodelbahn.json&action=raw
+ fetch("{{json_url}}").then(
+ function(response) {
+ return response.json();
+ }).then(
+ function(data) {
+ editor.setValue(data);
+ }
+ ).catch(function (err) {
+ console.log(err);
+ })
+ });
+
+
+ // Hook up the submit button to log to the console
+ document.getElementById('submit').addEventListener('click',function() {
+ // Get the value from the editor
+ console.log(editor.getValue());
+ });
+</script>
+{% endblock %}