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.
 
 
 
 
 
 

133 lines
4.5 KiB

{% extends 'admin_list.html' %}
{% load i18n %}
{% block styles %}
td a{
float:left;
margin: 0 10px 10px 0
}
{% endblock %}
{% block body %}
{% load i18n %}
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-arrow-down"></i>{% trans "Фильтры" %}</h2>
</div>
<div class="box-content">
<form class="form-horizontal">
{% for field in form %}
<div class="control-group {% if field.errors %}error{% endif %}">
<label class="control-label"><b>{{ field.label }}:</b></label>
<div class="controls">{{ field }}
<span class="help-inline">{{ field.errors }}</span>
</div>
</div>
{% endfor %}
<button type="submit" class="btn">{% trans "Найти" %}</button>
</form>
</div>
</div>
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-arrow-down"></i>{% trans "Список выставок" %}</h2>
</div>
<div class="box-content">
<table class="table table-hover">
<col width="25%">
<col width="15%">
<col width="35%">
<col width="25%">
<thead>
<tr>
<th>{% trans "Название" %}</th>
<th>{% trans "Дата начала" %}</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for item in object_list %}
<tr>
<td>{{ item.name }}</td>
<td>{{ item.data_begin|date:"Y-m-d" }}<br><i class="icon-eye-open"></i> {{ item.get_objectstat_views }}</td>
<td>
<a class="btn-small btn-inverse copy" data-id="{{ item.id }}" href="#">{% trans "Копировать" %}</a>
<a class="btn-small btn-success" target="_blank"
href="{% url 'redirects-add-expo' item.url %}" title="{% trans "Сгенерировать новый URL из названия и назначить редирект" %}">
{% trans "Генерация урл" %}
</a>
<input id="copy_url_{{ item.id }}" type="text" placeholder="новый урл">
</td>
<td style="width: 200px; height:100px;">
<a class="btn-small btn-warning off" style="{% if item.is_published %}{% else %}display: none;{% endif %}"
href="/admin/exposition/switch/{{ item.url }}/off">
{% trans "Отключить" %}
</a>
<a class="btn-small btn-success on" style="{% if item.is_published %}display: none;{% else %}{% endif %}"
href="/admin/exposition/switch/{{ item.url }}/on">
{% trans "Включить" %}
</a>
<a class="btn-small btn-info" href="/admin/exposition/{{ item.url|lower }}">
{% trans "Изменить" %}
</a>
<a class="btn-small btn-inverse" target="_blank" href="{{ item.get_permanent_url }}">
{% trans "на сайте" %}
</a>
<a class="btn-small btn-danger" href="/admin/exposition/delete/{{ item.url|lower }}">
{% trans "Удалить" %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a class="btn btn-success" href="/admin/exposition/"><i class="icon-plus-sign icon-white"></i> {% trans "Добавить выставку" %}</a>
</div>
{# pagination #}
{% include 'c_admin/includes/admin_pagination.html' with page_obj=object_list %}
</div>
<script>
$(function(){
$('.copy').on('click', function(e){
e.preventDefault();
var id = $(this).attr('data-id');
var copy_url = '#copy_url_'+id
var input_url = $(copy_url).val();
if(input_url == ''){
alert('{% trans "Урл не должен быть пустым" %}')
}
else{
url = '/admin/exposition/copy/';
formData = {'id': id, url: input_url};
$.get(url, formData, function(data){
if(data['redirect']==''){
alert(data['msg'])
}
else{
window.location = data['redirect'];
}
})
}
});
})
</script>
{% endblock %}