1 {% extends
"descriptor/descriptor_view_base.html" %}
6 {% block title_header_big %}
8 Edit {{ descriptor_type|upper }} Descriptor
12 {% block left_sidebar %}
13 {% include 'osm/osm_project_left_sidebar.html' %}
16 {% block breadcrumb_body %}
18 <li><a href=
"{% url 'projects:open_project' %}">{{project_id}}
</a></li>
19 <li><a href=
"{% url 'projects:open_project' %}descriptors/{{descriptor_type}}">{{ descriptor_type }} Descriptors
</a></li>
20 <li><a>{{descriptor_id}}
</a></li>
23 {% block tab_pane_button_list %}
25 <li class=
"active" id=
"yaml_li"><a href=
"#yaml" data-toggle=
"tab"><i class=
"fa fa-file-code-o"></i> YAML
</a></li>
26 <li id=
"json_li"><a href=
"#json" data-toggle=
"tab"><i class=
"fa fa-file-code-o"></i> JSON
</a></li>
29 {% block nav_buttons_list %}
31 <li class=
"pull-right"><button id=
"save" type=
"button" class=
"btn btn-block btn-primary btn-sm" onclick=
"update(this.id)" ><i class=
"fa fa-save"></i> Update
</button></li>
32 <li class=
"pull-right"><button id=
"save_show_graph" type=
"button" class=
"btn btn-block btn-primary btn-sm" onclick=
"update(this.id)" disabled
><i class=
"fa fa-save"></i> Update and Show Graph
</button></li>
33 <li class=
"pull-right"><button type=
"button" class=
"btn btn-block btn-primary btn-sm" onclick=
"goToGraph()" disabled
><i class=
"fa fa-sitemap"></i> Show Graph
</button></li>
36 {% block tab_pane_list %}
40 <div class=
"active tab-pane" id=
"yaml">
41 <textarea id=
"code_editor_yaml">
46 <div class=
"tab-pane" id=
"json">
47 <textarea id=
"code_editor_json">
53 {% block resource_block %}
61 $(document).ready(function () {
62 //var cmjsoneditor = CodeMirror.fromTextArea(document.getElementById(
"code_editor"), json_editor_settings);
63 var myJsonTextArea = document.getElementById(
"code_editor_json");
64 editorJSON = CodeMirror(function (elt) {
65 myJsonTextArea.parentNode.replaceChild(elt, myJsonTextArea);
66 }, json_editor_settings);
69 editorJSON.setValue(JSON.stringify({{descriptor_strings.descriptor_string_json | safe}}, null,
"\t"));
70 editorJSON.setOption(
"autoRefresh", true);
71 var myYamlTextArea = document.getElementById(
"code_editor_yaml");
72 editorYaml = CodeMirror(function (elt) {
73 myYamlTextArea.parentNode.replaceChild(elt, myYamlTextArea);
74 }, yaml_editor_settings);
75 var des_strings = {{descriptor_strings | safe}};
76 editorYaml.setValue(des_strings.descriptor_string_yaml);
82 var dialog = bootbox.dialog({
83 message: '
<div class=
"text-center"><i class=
"fa fa-spin fa-spinner"></i> Loading...
</div>',
87 var id = $('.nav-tabs .active').attr('id');
92 text = editorYaml.getValue();
96 text = editorJSON.getValue();
100 url:
"/projects/descriptors/{{descriptor_type}}/{{descriptor_id}}/",
104 'csrfmiddlewaretoken': '{{csrf_token}}',
108 success: function (result) {
109 dialog.modal('hide');
112 error: function (result) {
114 dialog.modal('hide');
115 bootbox.alert(result);
125 {% include
"footer.html" %}