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.
152 lines
5.1 KiB
152 lines
5.1 KiB
{% extends 'base.html' %}
|
|
{% load static %}
|
|
{% load i18n %}
|
|
|
|
{% block scripts %}
|
|
|
|
{# selects #}
|
|
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
|
|
<style>
|
|
ul {
|
|
list-style: none;
|
|
}
|
|
</style>
|
|
<script src="{% static 'js/select/select2.js' %}"></script>
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
console.log(1);
|
|
$("#id_countries").select2({width:'element'});
|
|
$('#id_expositions, #id_exclude_expositions').select2({
|
|
placeholder: '{% trans "Выставки" %}',
|
|
width: 'element',
|
|
multiple: true,
|
|
ajax: {
|
|
|
|
url: "/admin/exposition/search/",
|
|
dataType: "json",
|
|
quietMillis: 200,
|
|
multiple: true,
|
|
|
|
data: function (term, page) {
|
|
return {
|
|
term: term,
|
|
page: page
|
|
};
|
|
},
|
|
|
|
results: function (data) {
|
|
var results = [];
|
|
$.each(data, function (index, item) {
|
|
results.push({
|
|
id: item.id,
|
|
text: item.label
|
|
});
|
|
});
|
|
return {results: results};
|
|
}
|
|
},
|
|
initSelection: function (element, callback) {
|
|
var data = [];
|
|
var values = element.val();
|
|
element.val("");
|
|
$(values.split(",")).each(function (i) {
|
|
var item = this.split(':');
|
|
data.push({
|
|
id: item[0],
|
|
text: item[1]
|
|
});
|
|
});
|
|
console.log("initselection data: ");
|
|
console.log(data);
|
|
callback(data);
|
|
|
|
}
|
|
|
|
});
|
|
$('#id_conferences, #id_exclude_conferences').select2({
|
|
placeholder: '{% trans "Конференции" %}',
|
|
width: 'element',
|
|
multiple: true,
|
|
ajax: {
|
|
|
|
url: "/admin/conference/search/",
|
|
dataType: "json",
|
|
quietMillis: 200,
|
|
multiple: true,
|
|
|
|
data: function (term, page) {
|
|
return {
|
|
term: term,
|
|
page: page
|
|
};
|
|
},
|
|
|
|
results: function (data) {
|
|
var results = [];
|
|
$.each(data, function (index, item) {
|
|
results.push({
|
|
id: item.id,
|
|
text: item.label
|
|
});
|
|
});
|
|
return {results: results};
|
|
}
|
|
},
|
|
initSelection: function (element, callback) {
|
|
var data = [];
|
|
var values = element.val();
|
|
element.val("");
|
|
$(values.split(",")).each(function (i) {
|
|
var item = this.split(':');
|
|
data.push({
|
|
id: item[0],
|
|
text: item[1]
|
|
});
|
|
});
|
|
callback(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|
|
|
|
{% block body %}
|
|
|
|
{# Uses multilang.html template for translated fields #}
|
|
<form class="form-horizontal" method="post" action="">{% csrf_token %}
|
|
<fieldset>
|
|
<div class="box span8">
|
|
<div class="box-header well">
|
|
<h2><i class="icon-pencil"></i>{% if form.instance.pk %} {% trans "Изменение" %} {% else %} {% trans "Добавление" %} {% endif %} {% trans "настройки услуги" %}</h2>
|
|
</div>
|
|
<div class="box-content">
|
|
{% for f in form %}
|
|
<div class="control-group {% if f.errors %}error{% endif %}">
|
|
<label class="control-label"><b>{{ f.label }}:</b></label>
|
|
<div class="controls">{{ f }}
|
|
<span class="help-inline">{{ f.errors }}</span>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
<div class="box-content">
|
|
<i class="icon-info-sign"></i>{% trans "Исключение имеет приоритет над отображением." %}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="controls">
|
|
<button type="submit" class="btn btn-large btn-primary">{% trans "Submit" %}</button>
|
|
<button type="reset" class="btn btn-large">{% trans "Reset" %}</button>
|
|
</div>
|
|
</fieldset>
|
|
</form>
|
|
|
|
|
|
{% endblock %}
|
|
|