2018-11-16 08:10:35 +00:00
|
|
|
{% extends "administration/base.html" %}
|
|
|
|
|
|
|
|
{% load i18n %}
|
2018-11-26 21:30:14 +00:00
|
|
|
{% load utils %}
|
2019-03-10 17:06:06 +00:00
|
|
|
{% load static %}
|
2018-11-16 08:10:35 +00:00
|
|
|
|
2019-03-08 14:11:01 +00:00
|
|
|
{% block head %}
|
|
|
|
{{ block.super }}
|
|
|
|
{{ form.media.css }}
|
2019-03-10 17:06:06 +00:00
|
|
|
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'admin/js/vendor/jquery/jquery.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'admin/js/core.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'admin/js/actions.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'admin/js/urlify.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'admin/js/prepopulate.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'admin/js/SelectBox.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'admin/js/SelectFilter2.js' %}"></script>
|
2019-10-12 12:23:03 +00:00
|
|
|
<script src="{% static 'codemirror/lib/codemirror.js' %}"></script>
|
|
|
|
<link rel="stylesheet" href="{% static 'codemirror/lib/codemirror.css' %}">
|
|
|
|
<link rel="stylesheet" href="{% static 'codemirror/theme/monokai.css' %}">
|
|
|
|
<script src="{% static 'codemirror/mode/yaml/yaml.js' %}"></script>
|
2020-02-17 16:48:53 +00:00
|
|
|
<script src="{% static 'codemirror/mode/jinja2/jinja2.js' %}"></script>
|
2019-03-08 14:11:01 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2018-11-16 08:10:35 +00:00
|
|
|
{% block content %}
|
|
|
|
<div class="container">
|
|
|
|
{% block above_form %}
|
|
|
|
{% endblock %}
|
2018-11-26 21:08:18 +00:00
|
|
|
<div class="">
|
|
|
|
<form action="" method="post" class="form-horizontal">
|
2018-12-10 15:58:35 +00:00
|
|
|
{% include 'partials/form.html' with form=form %}
|
2020-02-17 19:29:41 +00:00
|
|
|
{% block beneath_form %}
|
|
|
|
{% endblock %}
|
2018-11-26 21:30:14 +00:00
|
|
|
<a class="btn btn-default" href="{% back %}">{% trans "Cancel" %}</a>
|
2019-02-25 15:40:46 +00:00
|
|
|
<input type="submit" class="btn btn-primary" value="{% block action %}{% endblock %}" />
|
2018-11-26 21:08:18 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
2019-10-12 12:23:03 +00:00
|
|
|
<script>
|
2020-02-17 16:48:53 +00:00
|
|
|
const attributes = document.getElementsByName('attributes');
|
2019-10-12 12:23:03 +00:00
|
|
|
if (attributes.length > 0) {
|
2020-02-17 16:48:53 +00:00
|
|
|
// https://github.com/codemirror/CodeMirror/issues/5092
|
|
|
|
attributes[0].removeAttribute("required");
|
|
|
|
const attributesCM = CodeMirror.fromTextArea(attributes[0], {
|
2019-10-12 12:23:03 +00:00
|
|
|
mode: 'yaml',
|
|
|
|
theme: 'monokai',
|
|
|
|
lineNumbers: true,
|
|
|
|
});
|
|
|
|
}
|
2020-02-17 16:48:53 +00:00
|
|
|
const templates = document.getElementsByName('template');
|
|
|
|
if (templates.length > 0) {
|
|
|
|
// https://github.com/codemirror/CodeMirror/issues/5092
|
|
|
|
templates[0].removeAttribute("required");
|
|
|
|
const templateCM = CodeMirror.fromTextArea(templates[0], {
|
|
|
|
mode: 'jinja2',
|
|
|
|
theme: 'monokai',
|
|
|
|
lineNumbers: true,
|
|
|
|
});
|
|
|
|
}
|
2019-10-12 12:23:03 +00:00
|
|
|
</script>
|
2018-11-16 08:10:35 +00:00
|
|
|
</div>
|
2018-12-10 15:58:35 +00:00
|
|
|
{% endblock %}
|
2019-03-08 14:11:01 +00:00
|
|
|
|
|
|
|
{% block scripts %}
|
|
|
|
{{ block.super }}
|
|
|
|
{{ form.media.js }}
|
|
|
|
{% endblock %}
|