+ просит ввести email для продолжения регистрации через твиттер

+ день недели - по умолчанию поставить “среда”
 + не реализован текст под опциями
 + Москва должна быть включена внутрь блока
 + заголовок переименовать из
 + на пустое место добавить значок @
 + заглушка, должна вести на сайт, открытие настроек в новой вкладке
remotes/origin/stage6
Alexander Burdeinyi 9 years ago
parent 63901db985
commit df9dd17e85
  1. 3
      accounts/views.py
  2. 20
      emencia/django/newsletter/models.py
  3. 10
      fabfile.py
  4. 26
      functions/pipeline.py
  5. 30
      proj/forms.py
  6. 2
      registration/backends/default/views.py
  7. 1
      support/dev/settings.py
  8. 1
      support/prod/settings.py
  9. 30
      templates/client/accounts/mailing_settings.html
  10. 10
      templates/client/accounts/settings.html
  11. 5
      templates/client/includes/header.html
  12. 28
      templates/client/popups/unsubscribed.html
  13. 19
      templates/registration/acquire_email.html

@ -158,8 +158,7 @@ class MailingSettingsUnsubscribe(GetUserMixin, RedirectView):
if contact is None:
return HttpResponseForbidden()
if contact.subscriber:
contact.subscriber = False
contact.save()
contact.unsubscribe()
return super(MailingSettingsUnsubscribe, self).get(request, *args, **kwargs)

@ -161,7 +161,7 @@ class Contact(models.Model):
periodic = models.PositiveSmallIntegerField(_(u'Периодичность отправки'),
choices=PERIODIC_CHOICES, default=PERIODIC_CHOICES.WEEK)
periodic_day = models.PositiveSmallIntegerField(_(u'День отправки'),
choices=PERIODIC_DAY_CHOICES, default=PERIODIC_DAY_CHOICES.MON)
choices=PERIODIC_DAY_CHOICES, default=PERIODIC_DAY_CHOICES.WED)
content_news = models.BooleanField(_(u'Новости событий'), blank=True, default=True)
content_overview = models.BooleanField(_(u'Обзоры'), blank=True, default=True)
content_articles = models.BooleanField(_(u'Статьи из блога по участию в вывставках'), blank=True, default=True)
@ -178,6 +178,20 @@ class Contact(models.Model):
objects = ContactManager()
def unsubscribe(self):
self.subscriber = False
self.moscow = False
self.russia = False
self.foreign = False
self.content_news = False
self.content_overview = False
self.content_articles = False
self.tags.clear()
self.themes.clear()
self.f_countries.clear()
self.r_cities.clear()
self.save()
def subscriptions(self):
"""Return the user subscriptions"""
return MailingList.objects.filter(subscribers=self)
@ -267,7 +281,9 @@ class Contact(models.Model):
r_date = date + relativedelta.relativedelta(months=1)
russia_sqs = SearchQuerySet().models(Exposition, Conference) \
.filter(country_id=Exact(settings.RUSSIA_PK), data_begin__gte=r_date) \
.exclude(city_id=Exact(settings.MOSCOW_PK))
# .exclude(city_id=Exact(settings.MOSCOW_PK))
if r_cities or self.moscow:
russia_sqs = russia_sqs.exclude(city_id=Exact(settings.MOSCOW_PK))
if r_cities:
russia_sqs = russia_sqs.filter(city_id__in=r_cities)
if th_tg_filter is not None:

10
fabfile.py vendored

@ -15,7 +15,7 @@ env.passwords = {
}
REMOTE_HOME_DIR = '/home/www/expomap/'
LOCAL_HOME_DIR = '/home/alexander/projects/expomap/'
LOCAL_HOME_DIR = '/home/as/PycharmProjects/expomap/'
nginx_conf_tech = '/etc/nginx/sites-available/tech_work_hit.expomap.ru'
nginx_conf = '/etc/nginx/sites-available/hit.expomap.ru'
@ -86,14 +86,14 @@ def get_configs():
def put_configs():
localdir = join(LOCAL_HOME_DIR, 'support/', env.role)
# nginx
put(join(localdir, basename(nginx_conf)),
nginx_conf)
# put(join(localdir, basename(nginx_conf)),
# nginx_conf)
# # apache2
# put(join(localdir, basename(apache2_conf)),
# apache2_conf)
# settings
# put(join(localdir, basename(settings_conf)),
# settings_conf)
put(join(localdir, basename(settings_conf)),
settings_conf)
def newsletters_media():

@ -9,10 +9,11 @@ from django.contrib.sites.models import RequestSite, Site
from django.core import signing
from django.core.mail import EmailMultiAlternatives
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.shortcuts import redirect, render
from registration import signals
from registration.models import RegistrationProfile
from social.pipeline.partial import partial
from proj.forms import EmailForm, AssociateForm
def random_pass():
@ -60,18 +61,21 @@ def create_user(strategy, details, response, uid, user=None, *args, **kwargs):
def require_email(strategy, details, user=None, is_new=False, *args, **kwargs):
if user and user.email:
return
elif is_new and not details.get('email'):
email = strategy.request_data().get('email')
import pdb; pdb.set_trace()
if not email:
strategy.request.session['new_email'] = True
return redirect('acquire_email')
elif email and not User.objects.filter(email=email).exists():
email = details.get('email')
if is_new and not email:
form = EmailForm(strategy.request.POST or None)
if strategy.request.method == "POST" and form.is_valid():
email = form.cleaned_data.get('email')
if not User.objects.filter(email=email).exists():
details['email'] = email
return {'email': email}
else:
strategy.request.session['new_email'] = True
strategy.request.session['new_email_invalid'] = True
return redirect('acquire_email')
form = AssociateForm(strategy.request.POST or None)
if form.is_valid() and form.user:
details['email'] = email
return {'email': email, 'user': form.user}
return render(strategy.request, "registration/acquire_email.html", {'form': form})
return
def SendVerificationEmail(strategy, backend, code):

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext as _
from accounts.models import User
class EmailForm(forms.Form):
email = forms.EmailField(label=_(u'Email address'))
class AssociateForm(EmailForm):
_errors = {
'required': _(u'Данный email уже зарегистрирован. Авторизируйтесь чтобы привязать аккаунт.'),
'invalid': _(u'Неправильный логин или пароль.')
}
password = forms.CharField(label=_(u'Пароль'), widget=forms.PasswordInput(), error_messages=_errors)
def clean_password(self):
self.user = None
pw = self.cleaned_data.get('password')
if pw:
try:
self.user = User.objects.get(email=self.cleaned_data.get('email'))
except:
self.user = None
if self.user and not self.user.check_password(pw):
self.user = None
raise forms.ValidationError(self.fields['password'].error_messages['invalid'])
return pw

@ -248,7 +248,7 @@ def LoginView(request):
return HttpResponse(json.dumps(response), content_type='application/json')
else:
HttpResponseRedirect('/')
return HttpResponseRedirect('/')
def complete_registration(request):

@ -332,6 +332,7 @@ INSTALLED_APPS = (
'emencia.django.newsletter',
'accounts',
'article',
'comments',
'city',
'company',
'conference',

@ -332,6 +332,7 @@ INSTALLED_APPS = (
'emencia.django.newsletter',
'accounts',
'article',
'comments',
'city',
'company',
'conference',

@ -10,6 +10,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="{% static 'mailing_settings/css/main.css' %}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" defer></script>
</head>
<body>
@ -17,23 +18,17 @@
<div class="container">
<div class="logo_block">
<a href="/"><img src="{% static 'mailing_settings/images/logo.png' %}" alt="Expomap"></a>
<a href="#" class="back_to_site">expomap.ru <span>&#8250;</span></a>
<a href="/" class="back_to_site">expomap.ru <span>&#8250;</span></a>
</div>
<h1>{% trans 'Настройте рассылку от Expomap' %}</h1>
</div>
</header>
{% if not object.subscriber %}
<div class="reversed" style="border-left: 5px solid #ff9900; padding: 8px 12px; background-color: #fff; font-size:17px; text-align: justify; margin-bottom: 10px">
{% trans "Вы не являетесь подписчиком. Чтобы подписаться, выберите интересующие Вас данные." %}
</div>
{% endif %}
<form action="." method="post" id="mailing_settings_form">
{% csrf_token %}
<div class="themes_block">
<div class="container">
<h2>{% trans 'Какие письма вы хотите получать от нас?' %}</h2>
<h2>{% trans 'Какие события включать в Ваше письмо?' %}</h2>
<div class="columns">
<div class="column">
@ -107,16 +102,19 @@
<div class="column">
{{ form.content_news }}
{{ form.content_news.label_tag }}
<br>{% trans "Получайте новости выставок и конференций по выбранным тематикам" %}
</div>
<div class="column">
{{ form.content_overview }}
{{ form.content_overview.label_tag }}
<br>{% trans "Практические материалы, интервью, кейсы, которые помогут эффективно участвовать в выставках" %}
</div>
<div class="column">
{{ form.content_articles }}
{{ form.content_articles.label_tag }}
<br>{% trans "Блог о том, как создавать и продвигать крутые event`ы" %}
</div>
</div>
</div>
@ -179,9 +177,12 @@
<div id="countries_modal">
{% include 'client/popups/mailing_settings_countries.html' %}
</div>
<div id="unsibscribed_modal">
{% include 'client/popups/unsubscribed.html' %}
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.pack.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.js" defer></script>
<script type="application/javascript">
@ -213,6 +214,17 @@
// };
</script>
<script src="{% static 'mailing_settings/js/main.js' %}" defer></script>
{% if not object.subscriber %}
<script>
$(document).ready(function() {
var popupUnsibscribed = $('#unsibscribed');
$.fancybox(popupUnsibscribed, fbPopupOptions);
});
</script>
{# <div class="reversed" style="border-left: 5px solid #ff9900; padding: 8px 12px; background-color: #fff; font-size:17px; text-align: justify; margin-bottom: 10px">#}
{# {% trans "Вы не являетесь подписчиком. Чтобы подписаться, выберите интересующие Вас данные." %}#}
{# </div>#}
{% endif %}
</body>
</html>

@ -112,10 +112,10 @@
</div>
</div>
-->
<div class="set-sect subscribe">
<header>{% trans 'настройка подписки' %}</header>
<a href="{% url 'accounts-mailing_settings' %}" >{% trans 'Перейти к настройке' %}</a>
<span><img style="margin-right: -2px; margin-bottom: 4px;" src="{% static 'img/announce-letter.png' %}"></span>
{# <div class="set-sect subscribe">#}
{# <header>{% trans 'настройка подписки' %}</header>#}
{# <a href="{% url 'accounts-mailing_settings' %}" >{% trans 'Перейти к настройке' %}</a>#}
{# <span><img style="margin-right: -2px; margin-bottom: 4px;" src="{% static 'img/announce-letter.png' %}"></span>#}
{% comment %}
<div class="set-sect-body">
<form action="." method="post">
@ -194,7 +194,7 @@
</div>
{% endcomment %}
</div>
{# </div>#}
{% block scripts %}
<script>

@ -78,7 +78,10 @@
<a class="cl-btn icon-cal" href="{% url 'account_calendar' %}">{% trans 'календарь' %}</a>
<a class="cl-btn icon-doc" href="/profile/feed/">{% trans 'документы' %}</a>
</div>
<div class="clb-messages"><a class="icon-msg" href="/profile/messages/">{% if messages_inbox_count %} {{ messages_inbox_count }} {% endif %}</a></div>
<div class="clb-messages">
<a class="icon-msg" style="float: left;" href="/profile/messages/">{% if messages_inbox_count %} {{ messages_inbox_count }} {% endif %}</a>
<a href="{% url 'accounts-mailing_settings' %}" style="font-size: 18px" target="_blank">@</a>
</div>
<div class="clb-settings">
<a class="cl-btn icon-gear" href="/profile/settings/">{% trans 'настройки' %}</a>
</div>

@ -0,0 +1,28 @@
{% load static %}
{% load i18n %}
{% load template_filters %}
<div id="unsibscribed" class="popup-window unsibscribed">
<header>
<div class="title">{% trans 'Вы отписались от нашей рассылки' %}</div>
</header>
<div class="body">
<div class="themes_wrapper">
<div class="scroll-container">
<div class="scroll-content">
<div class="topics-list">
{% trans "Мы расстроены, но отписали Вас от всех писем. Надеемся, в скором времени вы снова захотите быть в курсе событий своей отрасли." %}
</div>
</div>
</div>
<div class="wait-ajax"></div>
</div>
{# <div class="buttons_block">#}
{# <button class="modal-approve" type="button">{% trans 'Выбрать' %}</button>#}
{# <button class="modal-clear" type="button">{% trans 'Очистить' %}</button>#}
{# </div>#}
</div>
</div>

@ -6,21 +6,22 @@
{% block page_body %}
<h1>{% trans "Enter your email" %}</h1>
<div cl>
</div>
{% if form.errors %}
<p class="error">{% trans "Please correct the errors below:" %}</p>
{% endif %}
<form class="form-inline" action="{% url "social:complete" backend=backend %}" method="post" role="form">{% csrf_token %}
<div class="form-group">
<div class="input-group">
<label class="control-label" for="id_email">{% trans "Email address:" %}</label>
<input class="form-control" id="id_email" type="email" name="email" placeholder="E-mail"/>
{# <input type="hidden" name="valid" value="no">#}
{% if invalid %}
{% trans "Такой Email уже существует." %}
{% endif %}
{# {% url "social:complete" backend=backend %}#}
<form class="form-inline" action="." method="post" role="form">{% csrf_token %}
{% for field in form %}
<div class="control-group {% if field.errors %}error{% endif %}">
<label class="control-label"><b>{{ field.label }}:</b></label>
<div class="controls">{{ field }}
<span class="help-inline">{{ field.errors }}</span>
</div>
</div>
{% endfor %}
<button class="btn btn-default" type="submit">{% trans "Submit" %}</button>
</form>

Loading…
Cancel
Save