You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
4.3 KiB
140 lines
4.3 KiB
{% extends "admin/base_site.html" %}
|
|
{% load i18n admin_modify cms_admin %}
|
|
{% block stylesheet %} {% endblock %}
|
|
|
|
{% block extrahead %}
|
|
<script type="text/javascript">
|
|
var current_site = {{current_site}};
|
|
</script>
|
|
{{ block.super }}
|
|
{{ media }}
|
|
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
(function($) {
|
|
function runOnLoad(f) {
|
|
if (runOnLoad.loaded){
|
|
f();
|
|
}else{
|
|
runOnLoad.funcs.push(f);
|
|
}
|
|
}
|
|
runOnLoad.funcs = [];
|
|
runOnLoad.loaded = false;
|
|
runOnLoad.run = function() {
|
|
if (runOnLoad.loaded) return;
|
|
|
|
for(var i = 0; i < runOnLoad.funcs.length; i++) {
|
|
try {
|
|
runOnLoad.funcs[i]();
|
|
}catch(e) { }
|
|
}
|
|
runOnLoad.loaded = true;
|
|
delete runOnLoad.funcs;
|
|
delete runOnLoad.run;
|
|
};
|
|
if (window.addEventListener){
|
|
window.addEventListener("load", runOnLoad.run, false);
|
|
}else if (window.attachEvent){
|
|
window.attachEvent("onload", runOnLoad.run);
|
|
}else{
|
|
window.onload = runOnLoad.run;
|
|
}
|
|
runOnLoad(function(){
|
|
parent.setiframeheight($('body').height()+20, {{ plugin.pk }});
|
|
});
|
|
|
|
$(document).ready(function(){
|
|
$("a.add-another,a.related-lookup").each(function(i, sign){
|
|
var href = $(sign).attr("href")
|
|
if (href.substr(0,2) == ".."){
|
|
href = "../../"+href
|
|
$(sign).attr("href", href);
|
|
}
|
|
});
|
|
|
|
var submitBtnName;
|
|
|
|
SnippetWidgetRegistry.initializeVariables();
|
|
$("#{{ opts.model_name }}_form").find(':submit').click(function(){
|
|
submitBtnName = $(this).attr('name');
|
|
});
|
|
$("#{{ opts.model_name }}_form").submit(function(){
|
|
if (submitBtnName !== '_cancel' && !SnippetWidgetRegistry.allValid()){
|
|
return false;
|
|
}
|
|
});
|
|
|
|
$('#id_snippet').change(function(){
|
|
var selected_snippet = $('#id_snippet').val();
|
|
var url = window.location.href
|
|
url += (url.indexOf('?') !== -1 ? '&':'?') + "snippet=" + selected_snippet;
|
|
window.location = url;
|
|
});
|
|
});
|
|
})(jQuery || django.jQuery);
|
|
//]]>
|
|
</script>
|
|
|
|
|
|
{% endblock %}
|
|
|
|
{% block extrastyle %}{% endblock %}
|
|
|
|
{% block coltype %}{% if ordered_objects %}colMS page-content{% else %}colM page-content no-padding-bottom{% endif %}{% endblock %}
|
|
|
|
{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
|
|
|
|
{% block content_title %}<h2>{{ plugin.get_plugin_name }}</h2>{% endblock %}
|
|
|
|
{% block content %}<div id="content-main">
|
|
{% block top %}{% if preview %}{% render_plugin plugin %}{% endif %}{% endblock %}
|
|
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %}
|
|
<div>
|
|
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
|
|
{% if current_site %}<input type="hidden" name="_current_site" value="{{current_site}}" />{% endif %}
|
|
{% if save_on_top %}{% submit_row %}{% endif %}
|
|
{% if errors %}
|
|
<p class="errornote">
|
|
{% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
|
|
</p>
|
|
<ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
|
|
{% endif %}
|
|
|
|
{% block fieldsets %}
|
|
{% for fieldset in adminform %}
|
|
{% include "admin/includes/fieldset.html" %}
|
|
{% endfor %}
|
|
{% endblock %}
|
|
|
|
{% block after_field_sets %}{% endblock %}
|
|
|
|
{% for inline_admin_formset in inline_admin_formsets %}
|
|
{% include inline_admin_formset.opts.template %}
|
|
{% endfor %}
|
|
|
|
{% block after_related_objects %}{% endblock %}
|
|
|
|
|
|
{% if add %}
|
|
<script type="text/javascript">
|
|
(function($) {
|
|
$(document).ready(function() {
|
|
$('form#{{ opts.model_name }}_form :input:visible:enabled:first').focus()
|
|
});
|
|
})(django.jQuery);
|
|
</script>
|
|
{% endif %}
|
|
|
|
{# JavaScript for prepopulated fields #}
|
|
{% prepopulated_fields_js %}
|
|
|
|
</div>
|
|
<span class="plugin-submit-row clearfix form-actions no-margin-bottom no-padding-right"{% if is_popup %} style="overflow: auto;"{% endif %}>
|
|
<input type="submit" name="_save" class="btn btn-info pull-right" value="{% trans "Save" %}" {{ onclick_attrib }}/>
|
|
<input type="submit" style="margin-left: 8px;" value="{% trans "Cancel" %}" name="_cancel" class="cancel-btn btn pull-right">
|
|
</span>
|
|
</form>
|
|
|
|
</div>
|
|
{% endblock %}
|
|
|