]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/blob - wradmin/templates/json_editor.html
Temporarily deactivate translation as long as {{0}} gets replaced by 0 by the templat...
[philipp/winterrodeln/wradmin.git] / wradmin / templates / json_editor.html
1 {% extends "master.html" %}
2 {% block head %}
3     <meta charset="utf-8" />
4     <title>{% block title %}JSON Editor{% endblock %}</title>
5     <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
6     <meta name="robots" content="noindex, nofollow" />
7     <link rel="shortcut icon" href="{{url_for('static', filename='favicon.png')}}" />
8     <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
9     <link rel="stylesheet" type="text/css" media="screen" href="{{url_for('static', filename='style.css')}}" />
10 {% endblock %}
11
12 {% block content %}
13 <div id='editor_holder'></div>
14 <button id='submit'>Submit (console.log)</button>
15
16 <script>
17     JSONEditor.defaults.options = {simplemde: {spellChecker: false}};
18
19     JSONEditor.defaults.languages.de = {
20     }
21
22     JSONEditor.defaults.languages.de_ = {
23     error_notset: 'Eigenschaft ist nicht gesetzt',
24     error_notempty: 'Wert erforderlich',
25     error_enum: 'Wert muss einem der vorgegebenen entsprechen',
26     error_anyOf: 'Wert muss mindestens nach einem der vorgegebenen Schemas gültig sein',
27     error_oneOf: 'Wert muss genau einem der vorgegebenen Schemas entsprechen. Derzeit ist es nach {{0}} Schemas gültig.',
28     error_not: 'Wert darf nach dem vorgegebenen Schema nicht gültig sein',
29     error_type_union: 'Wert muss einer der vorgegebenen Typen entsprechen',
30     error_type: 'Wert muss vom Typ {{0}} sein',
31     error_disallow_union: 'Wert darf nicht einer der vorgegebenen unerlaubten Typen sein',
32     error_disallow: 'Wert darf nicht vom Typ {{0}} sein',
33     error_multipleOf: 'Wert muss das vielfache von {{0}} sein',
34     error_maximum_excl: 'Wert muss kleiner sein als {{0}}',
35     error_maximum_incl: 'Wert darf maximal {{0}} sein',
36     error_minimum_excl: 'Wert muss größer sein als {{0}}',
37     error_minimum_incl: 'Wert muss mindestens {{0}} sein',
38     error_maxLength: 'Wert darf maximal {{0}} Zeichen lang sein',
39     error_minLength: 'Wert muss mindestens {{0}} Zeichen lang sein',
40     error_pattern: 'Wert muss dem vorgegebenen Muster {{0}} entsprechen',
41     error_additionalItems: 'In der Liste sind keine zusätzlichen Einträge erlaubt',
42     /**
43      * When there are to many items in an array
44      * @variables This key takes one variable: The maximum item count
45      */
46     error_maxItems: 'Value must have at most {{0}} items',
47     /**
48      * When there are not enough items in an array
49      * @variables This key takes one variable: The minimum item count
50      */
51     error_minItems: 'Value must have at least {{0}} items',
52     /**
53      * When an array is supposed to have unique items but has duplicates
54      */
55     error_uniqueItems: 'Array must have unique items',
56     /**
57      * When there are too many properties in an object
58      * @variables This key takes one variable: The maximum property count
59      */
60     error_maxProperties: 'Object must have at most {{0}} properties',
61     /**
62      * When there are not enough properties in an object
63      * @variables This key takes one variable: The minimum property count
64      */
65     error_minProperties: 'Object must have at least {{0}} properties',
66     /**
67      * When a required property is not defined
68      * @variables This key takes one variable: The name of the missing property
69      */
70     error_required: "Object is missing the required property '{{0}}'",
71     /**
72      * When there is an additional property is set whereas there should be none
73      * @variables This key takes one variable: The name of the additional property
74      */
75     error_additional_properties: 'No additional properties allowed, but property {{0}} is set',
76     /**
77      * When there is a propertyName that sets a max length and a property name exceeds the max length
78      * @variables This key takes one variable: The name of the invalid property
79      */
80     error_property_names_exceeds_maxlength: 'Property name {{0}} exceeds maxLength',
81     /**
82      * When there is a propertyName that sets an enum and a property name matches none of the possible enum
83      * @variables This key takes one variable: The name of the invalid property
84      */
85     error_property_names_enum_mismatch: 'Property name {{0}} does not match any enum values',
86     /**
87      * When there is a propertyName that sets a pattern and a property name does not match the pattern
88      * @variables This key takes one variable: The name of the invalid property
89      */
90     error_property_names_pattern_mismatch: 'Property name {{0}} does not match pattern',
91     /**
92      * When the propertyName is set to false and there is at least one property
93      * @variables This key takes one variable: The name of the invalid property
94      */
95     error_property_names_false: 'Property name {{0}} fails when propertyName is false',
96     /**
97      * When the propertyName specifies a maxLength that is not a number
98      * @variables This key takes one variable: The name of the current property
99      */
100     error_property_names_maxlength: 'Property name {{0}} cannot match invalid maxLength',
101     /**
102      * When the propertyName specifies an enum that is not an array
103      * @variables This key takes one variable: The name of the current property
104      */
105     error_property_names_enum: 'Property name {{0}} cannot match invalid enum',
106     /**
107      * When the propertyName specifies a pattern that is not a string
108      * @variables This key takes one variable: The name of the current property
109      */
110     error_property_names_pattern: 'Property name {{0}} cannot match invalid pattern',
111     /**
112      * When the propertyName is unsupported
113      * @variables This key takes one variable: The name of the invalid propertyName
114      */
115     error_property_names_unsupported: 'Unsupported propertyName {{0}}',
116     /**
117      * When a dependency is not resolved
118      * @variables This key takes one variable: The name of the missing property for the dependency
119      */
120     error_dependency: 'Must have property {{0}}',
121     /**
122      * When a date is in incorrect format
123      * @variables This key takes one variable: The valid format
124      */
125     error_date: 'Date must be in the format {{0}}',
126     /**
127      * When a time is in incorrect format
128      * @variables This key takes one variable: The valid format
129      */
130     error_time: 'Time must be in the format {{0}}',
131     /**
132      * When a datetime-local is in incorrect format
133      * @variables This key takes one variable: The valid format
134      */
135     error_datetime_local: 'Datetime must be in the format {{0}}',
136     /**
137      * When a integer date is less than 1 January 1970
138      */
139     error_invalid_epoch: 'Date must be greater than 1 January 1970',
140     /**
141      * When an IPv4 is in incorrect format
142      */
143     error_ipv4: 'Value must be a valid IPv4 address in the form of 4 numbers between 0 and 255, separated by dots',
144     /**
145      * When an IPv6 is in incorrect format
146      */
147     error_ipv6: 'Value must be a valid IPv6 address',
148     /**
149      * When a hostname is in incorrect format
150      */
151     error_hostname: 'The hostname has the wrong format',
152     /**
153      * Text on Delete All buttons
154      */
155     button_delete_all: 'All',
156     /**
157      * Title on Delete All buttons
158      */
159     button_delete_all_title: 'Delete All',
160     /**
161      * Text on Delete Last buttons
162      * @variable This key takes one variable: The title of object to delete
163      */
164     button_delete_last: 'Last {{0}}',
165     /**
166      * Title on Delete Last buttons
167      * @variable This key takes one variable: The title of object to delete
168      */
169     button_delete_last_title: 'Delete Last {{0}}',
170     /**
171      * Title on Add Row buttons
172      * @variable This key takes one variable: The title of object to add
173      */
174     button_add_row_title: 'Add {{0}}',
175     /**
176      * Title on Move Down buttons
177      */
178     button_move_down_title: 'Move down',
179     /**
180      * Title on Move Up buttons
181      */
182     button_move_up_title: 'Move up',
183     /**
184      * Title on Object Properties buttons
185      */
186     button_object_properties: 'Object Properties',
187     /**
188      * Title on Delete Row buttons
189      * @variable This key takes one variable: The title of object to delete
190      */
191     button_delete_row_title: '{{0}} löschen',
192     /**
193      * Title on Delete Row buttons, short version (no parameter with the object title)
194      */
195     button_delete_row_title_short: 'Löschen',
196     /**
197      * Title on Copy Row buttons, short version (no parameter with the object title)
198      */
199     button_copy_row_title_short: 'Copy',
200     /**
201      * Title on Collapse buttons
202      */
203     button_collapse: 'Collapse',
204     /**
205      * Title on Expand buttons
206      */
207     button_expand: 'Expand',
208     /**
209      * Title on Flatpickr toggle buttons
210      */
211     flatpickr_toggle_button: 'Toggle',
212     /**
213      * Title on Flatpickr clear buttons
214      */
215     flatpickr_clear_button: 'Clear',
216     /**
217      * Choices input field placeholder text
218      */
219     choices_placeholder_text: 'Start typing to add value',
220     /**
221      * Default title for array items
222      */
223     default_array_item_title: 'item',
224     /**
225      * Warning when deleting a node
226      */
227     button_delete_node_warning: 'Are you sure you want to remove this node?'
228 }
229
230
231
232
233
234     JSONEditor.defaults.language = "de";
235
236
237     // Initialize the editor with a JSON schema
238     var editor = new JSONEditor(document.getElementById('editor_holder'), {
239         schema: {"$ref": {{schema_url|tojson}}},
240         theme: 'bootstrap4',
241         ajax: true
242     });
243
244     editor.on('ready',() => {
245         fetch({{json_url|tojson}}).then(
246             function(response) {
247                 return response.json();
248             }).then(
249                 function(data) {
250                     editor.setValue(data);
251                 }
252             ).catch(function (err) {
253                 console.log(err);
254             })
255     });
256
257
258     // Hook up the submit button to log to the console
259     document.getElementById('submit').addEventListener('click',function() {
260         // Get the value from the editor
261         console.log(editor.getValue());
262     });
263 </script>
264 {% endblock %}