Merge branch 'develop' of gitlab.com:OldminTeam/expomap into develop

remotes/origin/HEAD
Slava Kyrachevsky 9 years ago
commit a1c0ee9ef1
  1. 2
      apps/accounts/urls.py
  2. 3
      apps/accounts/views.py
  3. 30
      static/custom_js/main.js
  4. 12
      static/custom_js/select_tag.js
  5. 57
      static/mailing_settings/css/main.css
  6. 16
      static/mailing_settings/js/main.js
  7. 6
      templates/c_admin/article/blog_form.html
  8. 22
      templates/client/newsletters/mailing_settings.html

@ -42,7 +42,7 @@ urlpatterns = patterns('',
url(r'^profile/change-password/', 'accounts.views.change_password'),
url(
r'^profile/subscribe-themes-tags/$',
login_required(UserSubscribeThemesTagsView.as_view()),
UserSubscribeThemesTagsView.as_view(),
name='user_subscribe_themes_tags'
),

@ -543,9 +543,12 @@ class UserSubscribeThemesTagsView(GetUserMixin, TemplateView):
ctx = super(UserSubscribeThemesTagsView, self).get_context_data(**kwargs)
data = []
instance = self.get_user()
user_themes = []
user_tags = []
themes = Theme.objects.language().values('pk', 'name')
if instance is not None:
user_themes = instance.themes.values_list('pk', flat=True)
user_tags = instance.tags.values_list('pk', flat=True)

@ -325,13 +325,12 @@ $(document).ready(function(){
}
if( $("#id_tag" ).length && $("#id_tag").is('select')) {
try{
$('#id_tag').select2({
placeholder: "Теги",
width: '550px',
multiple: true,
ajax: {
url: "/admin/theme/tag/search/",
dataType: "json",
quietMillis: 200,
@ -339,9 +338,11 @@ $(document).ready(function(){
data: function(term, page, theme){
var theme = $('#id_theme').serialize();
return {term: term,
return {
term: term,
page: page,
theme: theme};
theme: theme
};
},
results: function (data) {
@ -365,10 +366,12 @@ $(document).ready(function(){
});
});
callback(data);
}
});
} catch (e) {
console.log('===== Error =====');
console.warn(e);
console.log('=================')
}
@ -377,15 +380,16 @@ $(document).ready(function(){
*/
// theme change
$('#id_theme').change(function(){
$.get(
"/admin/ajax_tag/", {'id': $(this).serialize()}, function(data){
$.get("/admin/ajax_tag/", {'id': $(this).serialize()}, function(data){
var optionValues = [];
var getValues = [];
var selectedValues = []
var selectedValues = [];
//push values sended from server in array
$.each(data, function(i, elem){
getValues.push(elem[0].toString())
});
//delete options if they aren't in getvalues
//otherwise push it in array
//also push in array already selected values
@ -401,6 +405,7 @@ $(document).ready(function(){
optionValues.push($(this).val());
}
});
//generate new options
//old options unchanged
var html = ''
@ -415,6 +420,7 @@ $(document).ready(function(){
html += '</option>';
}
});
$('#id_tag').append(html);
//select previous selected values
$('#id_tag option').each(function() {
@ -499,7 +505,11 @@ $(document).ready(function(){
allowClear: true
});
} catch (e){}
} catch (e){
console.log('===== Error =====');
console.warn(e);
console.log('=================');
}
}

@ -1,15 +1,16 @@
// replace
$(document).ready(function(){
$('#id_theme').change(function(){
$.get(
"/admin/ajax_tag/", {'id': $(this).serialize()}, function(data){
$.get("/admin/ajax_tag/", {'id': $(this).serialize()}, function(data){
var optionValues = [];
var getValues = [];
var selectedValues = []
var selectedValues = [];
//push values sended from server in array
$.each(data, function(i, elem){
getValues.push(elem[0].toString())
});
//delete options if they aren't in getvalues
//otherwise push it in array
//also push in array already selected values
@ -25,9 +26,10 @@ $(document).ready(function(){
optionValues.push($(this).val());
}
});
//generate new options
//old options unchanged
var html = ''
var html = '';
$.each(data, function(i, elem){
var check = $.inArray(elem[0].toString(), optionValues);
@ -39,7 +41,9 @@ $(document).ready(function(){
html += '</option>';
}
});
$('#id_tag').append(html);
//select previous selected values
$('#id_tag option').each(function() {
var check = $.inArray($(this).val(), selectedValues)

@ -842,35 +842,43 @@ a.themes_trigger{
}
.pr-form .pr-row{
overflow:hidden;
/*overflow:hidden;*/
margin:0 0 14px;
}
.pr-form .pr-row:after{
content: '';
display: block;
clear: both;
}
.pr-input{
float:left;
height:46px;
width:247px;
padding:0 44px 0 18px;
display: inline-block;
vertical-align: bottom;
margin:0 0 0 13px;
background:#fff;
border-radius:4px;
position:relative;
}
.errorlist{
list-style: none;
}
.text_error{
display: block;
text-align: center;
font-weight: 300;
font-size: 14px;
color: #bd2626;
padding-bottom: 3px;
}
.pr-input.field_error input{
box-shadow: 0 0 0 2px #f00;
}
.pr-input:first-child{
margin:0;
}
.pr-input:after{
content:'';
position:absolute;
top:13px;
right:14px;
width:20px;
height:20px;
}
.pr-input.pr-name:after{
background:url(../images/pr-icon02.png) no-repeat 50% 50%;
.pr-input.pr-name input{
background:#fff url(../images/pr-icon02.png) no-repeat 210px 50%;
}
.pr-input.pr-email:after{
background:url(../images/pr-icon03.png) no-repeat 50% 50%;
.pr-input.pr-email input{
background:#fff url(../images/pr-icon03.png) no-repeat 210px 50%;
}
.pr-form input {
@ -878,8 +886,13 @@ a.themes_trigger{
border:none;
color:#000;
font:17px/21px 'pf_dindisplay_promedium', Arial, Helvetica, sans-serif;
height:24px;
margin:12px 0 0;
height:46px;
width:247px;
padding:0 44px 0 18px;
background:#fff;
border-radius:4px;
position:relative;
}
.pr-form input:focus::-webkit-input-placeholder {
color:transparent;

@ -2,12 +2,24 @@
function sendForm () {
var $form = $('#mailing_settings_form');
$form.find('.field_error').removeClass('field_error');
$form.find('.text_error').remove();
$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),
data: $form.serializeArray(),
success: function(response){
console.log(response);
// success: function(response){
// console.log(response);
// },
error: function (error) {
var form_errors = error.responseJSON.form_errors;
$.each(form_errors, function (field, err) {
var $field = $form.find('#id_' + field);
$field.addClass('field_error');
$field.parent('.pr-input').prepend('<span class="text_error">' + err + '</span>');
})
}
});
}

@ -24,8 +24,8 @@
});
});
</script>
<link rel="stylesheet" href="{% static 'jQuery-filer/css/jquery.filer.css' %}">
<link rel="stylesheet" href="{% static 'jQuery-filer/css/jquery.filer-dragdropbox-theme.css' %}">
<script src="{% static 'jQuery-filer/js/jquery.filer.js' %}"></script>
@ -43,6 +43,7 @@
<div class="box-header well">
<h2><i class="icon-pencil"></i> {% trans "Основная информация" %}</h2>
</div>
<div class="box-content">
{# main_title #}
@ -55,6 +56,7 @@
<span class="help-inline">{{ form.publish_date.errors }}</span>
</div>
</div>
{% if not article %}
<div class="control-group {% if form.slug.errors %}error{% endif %}">
<label class="control-label">{{ form.slug.label }}:</label>
@ -64,6 +66,7 @@
</div>
</div>
{% endif %}
{# theme #}
<div class="control-group {% if form.theme.errors %}error{% endif %}">
<label class="control-label"><b>{{ form.theme.label }}:</b></label>
@ -72,6 +75,7 @@
<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>

@ -60,8 +60,15 @@
<div class="pr-form">
<fieldset>
<div class="pr-row">
<span class="pr-input pr-name">{{ form.first_name }}</span>
<span class="pr-input pr-email" >{{ form.email }}</span>
<span class="pr-input pr-name {% if form.first_name.errors %}field_error{% endif %}">
{% if form.first_name.errors %}<span class="text_error">{{ form.first_name.errors }}</span>{% endif %}
{{ form.first_name }}
</span>
<span class="pr-input pr-email {% if form.email.errors %}field_error{% endif %}">
{% if form.email.errors %}<span class="text_error">{{ form.email.errors }}</span>{% endif %}
{{ form.email }}
</span>
</div>
<button>{% trans 'Подписаться' %}</button>
</fieldset>
@ -195,11 +202,20 @@
</div>
<div class="button_block">
<div class="container">
{% if not user.is_authenticated %}
<div class="tos">
<strong>{% trans 'Нажимая «Подписаться», вы соглашаетесь получать' %} <br /> {% trans 'материалы компании Expomap на свой электронный адрес' %} </strong>
<a href="{% url 'termsofuse' %}" style="color:#a2a2a2;">{% trans "Пользовательское соглашение" %}</a>
</div>
<button type="submit">{% trans "Сохранить" %}</button>
{% endif %}
<button type="submit">
{% if user.is_authenticated %}
{% trans "Сохранить" %}
{% else %}
{% trans 'Подписаться' %}
{% endif %}
</button>
<a href="?unsibscribe=1">{% trans 'Не хочу быть в курсе событий (отписаться от всего)' %}</a>
</div>
</div>

Loading…
Cancel
Save