-
Notifications
You must be signed in to change notification settings - Fork 704
/
change_form.html
213 lines (176 loc) · 7.54 KB
/
change_form.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
{% extends "admin/base_site.html" %}
{% load i18n admin_static admin_modify suit_tags admin_urls %}
{% load url from suit_compat %}
{% block extrahead %}{{ block.super }}
{% url 'admin:jsi18n' as jsi18nurl %}
<script type="text/javascript" src="{{ jsi18nurl|default:"../../../jsi18n/" }}"></script>
{{ media }}
{% endblock %}
{% block extrajs %}
{{ block.super }}
{% if 'CONFIRM_UNSAVED_CHANGES'|suit_conf %}
<!-- Warn on leaving unsaved form -->
<script src="{% static 'suit/js/suit-form-confirm.js' %}"></script>
<script type="text/javascript">
confirmExitIfModified('{% firstof opts.model_name opts.module_name %}_form', '{% trans 'You have unsaved changes' %}.');
</script>
{% endif %}
{% if adminform.model_admin.suit_form_tabs %}
<script type="text/javascript">
(function ($) {
$(function () {
$('#suit_form_tabs').suit_form_tabs();
});
}(Suit.$))
</script>
{% endif %}
<script>
(function ($) {
$(function () {
$("#{% firstof opts.model_name opts.module_name %}_form").suit_form_debounce();
});
}(Suit.$))
</script>
{% endblock %}
{% block extrastyle %}
{{ block.super }}
{% endblock %}
{% block content_title_value %}
{% trans 'Add' %} {{ opts.verbose_name }}
{% endblock %}
{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}
{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
{% if not is_popup %}
{% block breadcrumbs %}
<ul class="breadcrumb">
<li>
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
<span class="divider">»</span>
</li>
<li>
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">{% firstof opts.app_config.verbose_name app_label|capfirst|escape %}</a>
<span class="divider">»</span>
</li>
<li>
{% if has_change_permission %}
<a href="{% url opts|admin_urlname:'changelist' %}">
{{ opts.verbose_name_plural|capfirst }}</a>{% else %}
{{ opts.verbose_name_plural|capfirst }}{% endif %}
<span class="divider">»</span>
</li>
<li class="active">
{% if add %}{% trans 'Add' %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
</li>
</ul>
{% endblock %}
{% endif %}
{% block content %}
<div id="content-main" class="inner-two-columns">
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post"
id="{% firstof opts.model_name opts.module_name %}_form" class="form-horizontal" novalidate>
<div class="inner-right-column">
<div class="box save-box">
{% block submit_buttons_bottom %}{% submit_row %}{% endblock %}
</div>
{% block object-tools %}
{% if change %}{% if not is_popup %}
<h4 class="italic-title">{% trans 'tools'|capfirst %}</h4>
<ul class="box menu-box">
{% block object-tools-items %}
<li>
{% if '1.9'|django_version_lt %}
<a href="history/" class="historylink">
{% else %}
{% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
<a href="{% add_preserved_filters history_url %}" class="historylink">
{% endif %}
<i class="icon-time icon-alpha75"></i>{% trans "History" %}</a>
</li>
{% if has_absolute_url %}
<li>
<a href="{{ absolute_url }}" class="viewsitelink"><i class="icon-eye-open icon-alpha75"></i>{% trans "View on site" %}</a>
</li>
{% endif %}
{% if has_add_permission %}
<li>
{% if '1.9'|django_version_lt %}
<a href="../add/">
{% else %}
<a href="{% url opts|admin_urlname:'add' %}">
{% endif %}
<i class="icon-plus-sign icon-alpha75"></i>{% blocktrans with opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
</a>
</li>
{# {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}</a>#}
{% endif %}
{% endblock %}
</ul>
{% endif %}{% endif %}
{% endblock %}
{% block sidebar %}{% endblock %}
</div>
<div class="inner-center-column">
{% csrf_token %}{% block form_top %}{% endblock %}
{% block suit_form_tabs %}
{% if adminform.model_admin.suit_form_tabs %}
<ul id="suit_form_tabs" class="nav nav-tabs nav-tabs-suit" data-tab-prefix="suit-tab">
{% for tab in adminform.model_admin.suit_form_tabs %}
<li><a href="#{{ tab.0 }}">{{ tab.1 }}</a></li>{% endfor %}
</ul>
{% endif %}
{% endblock %}
<div class="tab-content tab-content-main">
{% if is_popup %}
<input type="hidden" name="_popup" value="1"/>{% endif %}
{% if errors %}
<div class="alert alert-error">
{% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
{{ adminform.form.non_field_errors }}
</div>
{% endif %}
{# render suit_form_includes at top position #}
{% include 'suit/includes/change_form_includes.html' with position='top' %}
{% block field_sets %}
{% for fieldset in adminform %}
{% include "admin/includes/fieldset.html" %}
{% endfor %}
{% endblock %}
{% block after_field_sets %}{% endblock %}
{# render suit_form_includes at middle position #}
{% include 'suit/includes/change_form_includes.html' with position='middle' %}
{% block inline_field_sets %}
{% for inline_admin_formset in inline_admin_formsets %}
{% include inline_admin_formset.opts.template %}
{% endfor %}
{% endblock %}
</div>
{% block after_related_objects %}{% endblock %}
{# render suit_form_includes at last position #}
{% include 'suit/includes/change_form_includes.html' with position='bottom' %}
{% block admin_change_form_document_ready %}
<script type="text/javascript">
(function($) {
$(document).ready(function() {
$('.add-another').click(function(e) {
e.preventDefault();
showAddAnotherPopup(this);
});
$('.related-lookup').click(function(e) {
e.preventDefault();
showRelatedObjectLookupPopup(this);
});
{% if adminform and add %}
$('form#{% firstof opts.model_name opts.module_name %}_form :input[type!=button][type!=submit]:visible:enabled:first').focus()
{% endif %}
});
})(django.jQuery);
</script>
{% endblock %}
{# JavaScript for prepopulated fields #}
{% prepopulated_fields_js %}
</div>
</form>
</div>
{% endblock %}
{# Empty centered sidebar as now we use sidebar in content block#}
{% block sidebar_content %}{% endblock %}