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.
 
 
 
 
 
 

199 lines
8.2 KiB

{% extends 'base.html' %}
{% load static %}
{# Displays article form #}
{% block scripts %}
<script src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script>
{# selects #}
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
<script src="{% static 'js/select/select2.js' %}"></script>
<script src="{% static 'custom_js/make_select.js' %}"></script>
{# ajax #}
<script src="{% static 'custom_js/file_post_ajax.js' %}"></script>
<script src="{% static 'custom_js/select_tag.js' %}"></script>
<link href="{% static 'js/datetimepicker/css/datetimepicker.css' %}" rel="stylesheet"/>
<script src="{% static 'js/datetimepicker/js/bootstrap-datetimepicker.js' %}"></script>
<script>
$(document).ready(function(){
$('#id_publish_date').datetimepicker({
todayHighlight: true,
format : 'yyyy-mm-dd',
minView:2
});
});
</script>
{% endblock %}
{% block body %}
<form method="post" class="form-horizontal" name="form2" id="form2"enctype="multipart/form-data"> {% csrf_token %}
<fieldset>
<legend><i class="icon-edit"></i>{% if article %} Изменить {% else %} Добавить {% endif %}статью{% if article %}(<a href="{{ article.get_permanent_url }}" target="_blank">на сайте</a>){% endif %}</legend>
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-pencil"></i> Основная информация</h2>
</div>
<div class="box-content">
{# main_title #}
{% include 'admin/forms/multilang.html' with field='main_title' form=form languages=languages %}
<div class="control-group {% if form.publish_date.errors %}error{% endif %}">
<label class="control-label"><b>{{ form.publish_date.label }}:</b></label>
<div class="controls">
{{ form.publish_date }}
<span class="help-inline">{{ form.publish_date.errors }}</span>
</div>
</div>
{# theme #}
<div class="control-group {% if form.theme.errors %}error{% endif %}">
<label class="control-label"><b>{{ form.theme.label }}:</b></label>
<div class="controls">
{{ form.theme }}
<span class="help-inline">{{ form.theme.errors }}</span>
</div>
</div>
{# tag #}
<div class="control-group {% if form.tag.errors %}error{% endif %}">
<label class="control-label">{{ form.tag.label }}:</label>
<div class="controls">
{{ form.tag }}
<span class="help-inline">{{ form.tag.errors }}</span>
</div>
</div>
{# exposition #}
{% if form.exposition %}
<div class="control-group {% if form.exposition.errors %}error{% endif %}">
<label class="control-label">{{ form.exposition.label }}:</label>
<div class="controls">
{{ form.exposition }}
<span class="help-inline">{{ form.exposition.errors }}</span>
</div>
</div>
{% endif %}
{# conference #}
{% if form.conference%}
<div class="control-group {% if form.conference.errors %}error{% endif %}">
<label class="control-label">{{ form.conference.label }}:</label>
<div class="controls">
{{ form.conference }}
<span class="help-inline">{{ form.conference.errors }}</span>
</div>
</div>
{% endif %}
{# logo #}
<div class="control-group {% if form.logo.errors %}error{% endif %}">
<label class="control-label">{{ form.logo.label }}:</label>
<div class="controls">
{{ form.logo }}
{% if article.logo %}
<img src="{{ article.logo.url }}">
{% endif %}
<span class="help-inline">{{ form.logo.errors }}</span>
</div>
</div>
{# preview #}
{% include 'admin/forms/multilang.html' with field='preview' form=form languages=languages %}
{# description #}
{% include 'admin/forms/multilang.html' with field='description' form=form languages=languages %}
{# keywords #}
{% include 'admin/forms/multilang.html' with field='keywords' form=form languages=languages %}
{# title #}
{% include 'admin/forms/multilang.html' with field='title' form=form languages=languages %}
{# descriptions #}
{% include 'admin/forms/multilang.html' with field='descriptions' form=form languages=languages %}
</div>
</div>
<div class="box span8" id="file">
<div class="box-header well">
<h2><i class="icon-pencil"></i> Файлы</h2>
</div>
<div class="box-content">
{% if article %}
{# button that shows modal window with file form #}
<a href="#myModal" id="file_add" role="button" class="btn btn-info" data-toggle="modal">Добавить файл</a>
{% else %}
<p>Файлы можно добавлять только после введения основных данных</p>
{% endif %}
{# this div shows list of files and refreshes when new file added #}
<div id="file_list">
<table class="table table-hover">
<thead>
<tr>
<td>id</td>
<td>Файл</td>
<td>Имя</td>
<td>Назначение</td>
<td></td>
</tr>
</thead>
<tbody>
{% include 'file_list.html' with files=files %}
</tbody>
</table>
</div>
</div>
</div>
<div class="controls">
<input class="btn btn-large btn-primary" type="submit" value="{% if article %}Изменить{% else %}Добавить{% endif %}">
<input class="btn btn-large" type="reset" value="Отмена">
</div>
</fieldset>
</form>
{% include 'admin/includes/file_form.html' with file_form=file_form object=article %}
{% endblock %}
{% block bot_scripts %}
<script>
$(document).ready(function(){
$('#id_exposition').select2({
placeholder: "Выставки",
multiple: true,
ajax: {
url: "/admin/exposition/search/",
width: '550px',
dataType: "json",
quietMillis: 200,
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 id= $(element).val();
var text = $(element).attr('data-init-text');
callback({id: id, text:text});
}
});
});
</script>
{% endblock %}