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.
118 lines
5.2 KiB
118 lines
5.2 KiB
{% extends 'c_admin/base.html' %}
|
|
{% load static %}
|
|
{% load i18n %}
|
|
|
|
{% block scripts %}
|
|
<script src="{% static 'custom_js/formset_add.js' %}"></script>
|
|
<script src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script>
|
|
<link href="{% static 'js/select/select2.css' %}" rel="stylesheet"/>
|
|
<script src="{% static 'js/select/select2.js' %}"></script>
|
|
<script>
|
|
$(function(){
|
|
|
|
$('select').select2({width: "element"});
|
|
$('select#id_theme_for_filter').select2("destroy");
|
|
//$('#id_country').select2({width: "element"});
|
|
$('#id_sending_date').datetimepicker({
|
|
todayHighlight: true,
|
|
format : 'dd.mm.yyyy',
|
|
minView:2
|
|
});
|
|
|
|
$('#id_mailing_list').on('change', function(e){
|
|
$.get(
|
|
"{% url 'admin-newsletters-get-themes' %}",
|
|
{'id': $(this).val()},
|
|
function(data){
|
|
//generate new options
|
|
var html = '';
|
|
$.each(data.data, function(i, elem){
|
|
html += '<option value="' + elem.pk + '">' + elem.name + '</option>';
|
|
});
|
|
$('#id_theme_for_filter').html(html);
|
|
});//end get
|
|
});
|
|
|
|
function makeContent2() {
|
|
if ($('#id_ab_testing').is(':checked')) {
|
|
$('div#cke_id_content2 div.cke_contents').height($('div#cke_id_content div.cke_contents').height());
|
|
$('#id_content2, #id_title2, #id_preheader2, #id_ab_first_stage').parents('div.control-group').show();
|
|
} else {
|
|
$('#id_content2, #id_title2, #id_preheader2, #id_ab_first_stage').parents('div.control-group').hide();
|
|
}
|
|
}
|
|
makeContent2();
|
|
|
|
$('#id_ab_testing').change(function(e) {
|
|
makeContent2();
|
|
});
|
|
|
|
})
|
|
</script>
|
|
{% endblock %}
|
|
|
|
{% block body %}
|
|
|
|
<form method="post" class="form-horizontal" name="form2" id="form2" enctype="multipart/form-data"> {% csrf_token %}
|
|
<fieldset>
|
|
|
|
<div class="box span10">
|
|
<div class="box-header well">
|
|
<h2><i class="icon-pencil"></i>{% if object %}{% trans "Изменения" %}{% else %}{% trans "Создание" %}{% endif %} {% trans "рассылки" %}</h2>
|
|
</div>
|
|
|
|
<div class="box-content">
|
|
<i class="icon-info-sign"></i>{% trans "Доступные параметры для прехедера" %}:
|
|
<p>{% trans "{name} - имя пользователя" %}</p>
|
|
<p>{% trans "{themes} - темы на которые пользователь подписан (первые 3 + кол-во оставшихся)" %}</p>
|
|
<i class="icon-info-sign"></i>{% trans "Доступные параметры для контента" %}:
|
|
<p>{% trans "{name} - имя пользователя" %}</p>
|
|
</div>
|
|
|
|
<div class="box-content">
|
|
{% for field in form %}
|
|
<div class="control-group {% if field.errors %}error{% endif %}">
|
|
<label class="control-label">{% if field.field.required %}<b>{{ field.label }}:</b>{% else %}{{ field.label }}{% endif %}</label>
|
|
<div class="controls">{{ field }}
|
|
<span class="help-inline">{{ field.errors }}</span>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<div class="box span10">
|
|
<div class="box-header well">
|
|
<h2><i class="icon-pencil"></i>{% trans "Прикрепить файлы" %}</h2>
|
|
</div>
|
|
<div class="box-content">
|
|
{{ attachment_formset.management_form }}
|
|
<table class="table table-hover" style=" width: 100%;">
|
|
<thead>
|
|
<th>{% trans "тайтл" %}</th>
|
|
<th>{% trans "файл" %}</th>
|
|
<th> </th>
|
|
</thead>
|
|
<tbody>
|
|
{% for attachment_form in attachment_formset.forms %}
|
|
<tr class="item">
|
|
<td>{{ attachment_form.id }}{{ attachment_form.title }}</td>
|
|
<td>{{ attachment_form.file_attachment }}</td>
|
|
<td><a class="delete btn btn-danger" href="#"><i class="icon-trash icon-white"></i> {% trans "Удалить" %}</a></td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<p style=" padding-left: 20px"><a id="add" class="btn btn-success" href="#"><i class="icon-plus-sign icon-white"></i> {% trans "Добавить файл" %}</a></p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="controls">
|
|
<input class="btn btn-large btn-primary" type="submit" value="Готово">
|
|
<input class="btn btn-large" type="reset" value="Отмена">
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|
|
|