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.
 
 
 
 
 
 

165 lines
6.8 KiB

{% extends 'base.html' %}
{% load static %}
{% 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>
<script src="{% static 'custom_js/file_post_ajax.js' %}"></script>
{% endblock %}
{% block body %}
<form method="post" class="form-horizontal" enctype="multipart/form-data" name="form1" id="form1"> {% csrf_token %}
<fieldset>
<legend><i class="icon-edit"></i>{% if obj_id %} Изменить {% else %} Добавить {% endif %}фотоотчет</legend>
<div class="box span8" >
<div class="box-header well">
<h2><i class="icon-pencil"></i> Основная информация</h2>
</div>
<div class="box-content">
{{ form.key }}
{# name #}
{% with field='name' form=form languages=languages %}
{% include 'admin/forms/multilang.html' %}
{% endwith %}
{# description #}
{% with field='description' form=form languages=languages %}
{% include 'admin/forms/multilang.html' %}
{% endwith %}
{# 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>
{# 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>
{# seminar #}
<div class="control-group {% if form.seminar.errors %}error{% endif %}">
<label class="control-label">{{ form.seminar.label }}:</label>
<div class="controls">{{ form.seminar }}
<span class="help-inline">{{ form.seminar.errors }}</span>
</div>
</div>
</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">
{# button that shows modal window with file form #}
<a href="#myModal" id="photo_add" role="button" class="btn btn-info" data-toggle="modal">Добавить фото</a>
<div id="photo_list">
<table class="table table-hover">
<thead>
<tr>
<td>id</td>
<td>Фото</td>
<td>Имя</td>
<td></td>
</tr>
</thead>
<tbody>
{% for photo in photos %}
<tr>
<td>{{ file.id }}</td>
<td><img src="{{ photo.file_path.url }}"></td>
<td>{{ file.name }}</td>
<td>
<button class="btn btn-danger delete_file" value="{{ file.id }}">
<i class="icon-trash icon-white"></i> Удалить
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="box span8">
<div class="box-header well">
<h2><i class="icon-pencil"></i> Мета даные</h2>
</div>
<div class="box-content">
{% with field='keywords' form=form languages=languages %}
{% include 'admin/forms/multilang.html' %}
{% endwith %}
{% with field='title' form=form languages=languages %}
{% include 'admin/forms/multilang.html' %}
{% endwith %}
{% with field='descriptions' form=form languages=languages %}
{% include 'admin/forms/multilang.html' %}
{% endwith %}
</div>
</div>
<div class="controls">
<input class="btn btn-large btn-primary" type="submit" value="Добавить">
<input class="btn btn-large" type="reset" value="Отмена">
</div>
</fieldset>
</form>
{# modal window #}
<div class="modal hide fade" id="myModal" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="close">&times;</button>
<h3>Добавить фото</h3>
</div>
<div class="modal-body">
<form method="post" class="form-horizontal" enctype="multipart/form-data" name="photo_form" id="photo_form" > {% csrf_token %}
{{ photo_form.key }}
{{ photo_form.model }}
<input type="hidden" id="obj_id" value="{{ obj_id }}">
{# file_path #}
<div class="control-group{% if file_form.file_path.errors %}error{% endif %}">
<label class="control-label"><b>{{ photo_form.file_path.label }}:</b></label>
<div class="controls">{{ photo_form.file_path }}
<span class="help-inline">{{ photo_form.file_path.errors }}</span>
</div>
</div>
{# name #}
{% with field='name' form=photo_form languages=languages %}
{% include 'admin/forms/multilang.html' %}
{% endwith %}
{# description #}
{% with field='description' form=photo_form languages=languages %}
{% include 'admin/forms/multilang.html' %}
{% endwith %}
</div>
<div class="modal-footer">
<div class="controls">
<input class="btn btn-primary" type="submit" value="Добавить">
<input type="reset" class="btn" value="Отменить" data-dismiss="modal">
</form>
</div>
</div>
</div>
{% endblock %}