parent
700c4051a4
commit
22b010d372
12 changed files with 258 additions and 50 deletions
@ -0,0 +1,47 @@ |
|||||||
|
function make_event_select(id, url, placeholder){ |
||||||
|
$(id).select2({ |
||||||
|
placeholder: placeholder, |
||||||
|
multiple: true, |
||||||
|
ajax: { |
||||||
|
|
||||||
|
url: url, |
||||||
|
width: '550px', |
||||||
|
dataType: "json", |
||||||
|
quietMillis: 200, |
||||||
|
multiple: true, |
||||||
|
|
||||||
|
data: function(term, page, theme){ |
||||||
|
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 = []; |
||||||
|
$(element.val().split(",")).each(function(i) { |
||||||
|
var item = this.split(':'); |
||||||
|
data.push({ |
||||||
|
id: item[0], |
||||||
|
text: item[1] |
||||||
|
}); |
||||||
|
}); |
||||||
|
callback(data); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function(){ |
||||||
|
make_event_select('#id_expositions', '/admin/exposition/search/', 'Выставки'); |
||||||
|
make_event_select('#id_conferences', '/admin/conference/search/', 'Конференции'); |
||||||
|
}); |
||||||
@ -0,0 +1,70 @@ |
|||||||
|
{% extends 'base.html' %} |
||||||
|
{% load static %} |
||||||
|
|
||||||
|
{% block scripts %} |
||||||
|
|
||||||
|
|
||||||
|
{# selects #} |
||||||
|
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/> |
||||||
|
<script src="{% static 'js/select/select2.js' %}"></script> |
||||||
|
|
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block body %} |
||||||
|
|
||||||
|
<form method="post" class="form-horizontal" name="form" id="main_form"> {% csrf_token %} |
||||||
|
<fieldset> |
||||||
|
<legend><i class="icon-edit"></i>Управление услугой {{ object.name }}</legend> |
||||||
|
|
||||||
|
<div class="box span8" > |
||||||
|
<div class="box-header well"> |
||||||
|
<h2><i class="icon-pencil"></i></h2> |
||||||
|
</div> |
||||||
|
<div class="box-content"> |
||||||
|
{# event_type #} |
||||||
|
<div class="control-group {% if form.event_type.errors %}error{% endif %}"> |
||||||
|
<label class="control-label">{{ form.event_type.label }}:</label> |
||||||
|
<div class="controls"> |
||||||
|
{{ form.event_type }} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
{# region #} |
||||||
|
<div class="control-group {% if form.region.errors %}error{% endif %}"> |
||||||
|
<label class="control-label">{{ form.region.label }}:</label> |
||||||
|
<div class="controls">{{ form.region }} |
||||||
|
<span class="help-inline">{{ form.region.errors }}</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
{# country #} |
||||||
|
<div class="control-group {% if form.country.errors %}error{% endif %}"> |
||||||
|
<label class="control-label">{{ form.country.label }}:</label> |
||||||
|
<div class="controls">{{ form.country }} |
||||||
|
<span class="help-inline">{{ form.country.errors }}</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{# expositions #} |
||||||
|
<div class="control-group {% if form.expositions.errors %}error{% endif %}"> |
||||||
|
<label class="control-label">{{ form.expositions.label }}:</label> |
||||||
|
<div class="controls">{{ form.expositions }} |
||||||
|
<span class="help-inline">{{ form.expositions.errors }}</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{# conferences #} |
||||||
|
<div class="control-group {% if form.conferences.errors %}error{% endif %}"> |
||||||
|
<label class="control-label">{{ form.conferences.label }}:</label> |
||||||
|
<div class="controls">{{ form.conferences }} |
||||||
|
<span class="help-inline">{{ form.conferences.errors }}</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</fieldset> |
||||||
|
</form> |
||||||
|
{% endblock %} |
||||||
|
|
||||||
|
{% block bot_scripts %} |
||||||
|
<script src="{% static 'custom_js/find_events.js' %}"></script> |
||||||
|
{% endblock %} |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
{% extends 'admin_list.html' %} |
||||||
|
|
||||||
|
{% block body %} |
||||||
|
<div class="box span8"> |
||||||
|
<div class="box-header well"> |
||||||
|
<h2><i class="icon-arrow-down"></i>Список услуг</h2> |
||||||
|
</div> |
||||||
|
<div class="box-content"> |
||||||
|
|
||||||
|
<table class="table table-hover"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>id</th> |
||||||
|
<th>Название</th> |
||||||
|
<th> </th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
{% for item in object_list %} |
||||||
|
|
||||||
|
<tr> |
||||||
|
<td>{{ item.id }}</td> |
||||||
|
<td>{{ item.name }}</td> |
||||||
|
|
||||||
|
<td> |
||||||
|
<a class="btn-small btn-info" href="/admin/service/control/{{ item.id }}/"> |
||||||
|
Управлять |
||||||
|
</a> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
{% endfor %} |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
{# pagination #} |
||||||
|
{% include 'admin/includes/admin_pagination.html' with page_obj=object_list %} |
||||||
|
</div> |
||||||
|
{% endblock %} |
||||||
@ -1,3 +1 @@ |
|||||||
{% for text in object.get_index_text %} |
{{ object.get_index_text }} |
||||||
{{ text }} |
|
||||||
{% endfor %} |
|
||||||
Loading…
Reference in new issue