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.
 
 
 
 
 
 

222 lines
7.9 KiB

{% extends 'base.html' %}
{% load static %}
{# Displays city 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>
{# ajax #}
<script src="{% static 'custom_js/file_post_ajax.js' %}"></script>
{% endblock %}
{% block body %}
{# Uses multilang.html template for translated fields #}
<form method="post" class="form-horizontal" name="form2" id="form2" enctype="multipart/form-data"> {% 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">
{# Hidden inputs uses for comparing with TmpFile objects #}
{{ form.key }}
{# Hidden input uses in clean method for checking url #}
{{ form.city_id }}
{# name #}
{% with field='name' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# population #}
<div class="control-group">
<label class="control-label">{{ form.inflect.label }}:</label>
<div class="controls">
{{ form.inflect }}
</div>
</div>
{# country #}
<div class="control-group">
<label class="control-label"><b>{{ form.country.label }}:</b></label>
<div class="controls">{{ form.country}}</div>
</div>
<div class="control-group {% if form.logo.errors %}error{% endif %}">
<label class="control-label">{{ form.logo.label }}:</label>
<div class="controls">{{ form.logo }}
<span class="help-inline">{{ form.logo.errors }}</span>
</div>
</div>
{# region #}
{% with field='region' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# description #}
{% with field='description' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# famous places #}
{% with field='famous_places' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# population #}
<div class="control-group">
<label class="control-label">{{ form.population.label }}:</label>
<div class="controls">
<div class="input-prepend input-append">
{{ form.population }}<span class="add-on">млн</span>
</div>
</div>
</div>
{# phone code #}
<div class="control-group">
<label class="control-label">{{ form.phone_code.label }}:</label>
<div class="controls">{{ form.phone_code }}</div>
</div>
{# code IATA #}
<div class="control-group">
<label class="control-label">{{ form.code_IATA.label }}:</label>
<div class="controls">{{ form.code_IATA }}</div>
</div>
{# transport #}
{% with field='transport' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# shoping #}
{% with field='shoping' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
</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="file_add" role="button" class="btn btn-info" data-toggle="modal">Добавить файл</a>
{# 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>
{% for file in files %}
<tr>
<td>{{ file.id }}</td>
<td><img src="{{ file.file_path.url }}"></td>
<td>{{ file.file_name }}</td>
<td>{{ file.purpose }}</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 'c_admin/forms/multilang.html' %}
{% endwith %}
{% with field='title' form=form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{% with field='descriptions' form=form languages=languages %}
{% include 'c_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="Отмена"> </form>
</div>
</fieldset>
{# 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 id="form_body">
<div class="modal-body">
<form method="post" class="form-horizontal" enctype="multipart/form-data" name="file_form" id="file_form" > {% csrf_token %}
{# hidden inputs uses for comparing with City form key#}
{{ file_form.key }}
{{ file_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>{{ file_form.file_path.label }}:</b></label>
<div class="controls">{{ file_form.file_path }}
<span class="help-inline">{{ file_form.file_path.errors }}</span>
</div>
</div>
{# file purpose #}
<div class="control-group{% if file_form.purpose.errors %}error{% endif %}">
<label class="control-label"><b>{{ file_form.purpose.label }}:</b></label>
<div class="controls">{{ file_form.purpose }}
<span class="help-inline">{{ file_form.purpose.errors }}</span>
</div>
</div>
{# file_name #}
{% with field='file_name' form=file_form languages=languages %}
{% include 'c_admin/forms/multilang.html' %}
{% endwith %}
{# file_description #}
{% with field='description' form=file_form languages=languages %}
{% include 'c_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>
</div>
{% endblock %}