68 lines
2.5 KiB
HTML
68 lines
2.5 KiB
HTML
{% extends "administration/base.html" %}
|
|
|
|
{% load i18n %}
|
|
{% load utils %}
|
|
{% load static %}
|
|
|
|
{% block head %}
|
|
{{ block.super }}
|
|
{{ form.media.css }}
|
|
<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>
|
|
<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>
|
|
<script src="{% static 'codemirror/mode/jinja2/jinja2.js' %}"></script>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container">
|
|
{% block above_form %}
|
|
{% endblock %}
|
|
<div class="">
|
|
<form action="" method="post" class="form-horizontal">
|
|
{% include 'partials/form.html' with form=form %}
|
|
{% block beneath_form %}
|
|
{% endblock %}
|
|
<a class="btn btn-default" href="{% back %}">{% trans "Cancel" %}</a>
|
|
<input type="submit" class="btn btn-primary" value="{% block action %}{% endblock %}" />
|
|
</form>
|
|
</div>
|
|
<script>
|
|
const attributes = document.getElementsByName('attributes');
|
|
if (attributes.length > 0) {
|
|
// https://github.com/codemirror/CodeMirror/issues/5092
|
|
attributes[0].removeAttribute("required");
|
|
const attributesCM = CodeMirror.fromTextArea(attributes[0], {
|
|
mode: 'yaml',
|
|
theme: 'monokai',
|
|
lineNumbers: true,
|
|
});
|
|
}
|
|
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,
|
|
});
|
|
}
|
|
</script>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
{{ block.super }}
|
|
{{ form.media.js }}
|
|
{% endblock %}
|