From 431362c91897260f2a8bd607974de35145e2cb2a Mon Sep 17 00:00:00 2001 From: Slava Kyrachevsky Date: Wed, 8 Feb 2017 11:08:19 +0200 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B8=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=80=D0=B0=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/accounts/views.py | 11 +- .../django/newsletter/views/expo_views.py | 9 +- .../client/accounts/mailing_settings.html | 259 ------------------ templates/client/includes/header.html | 2 +- .../client/newsletters/mailing_settings.html | 59 ++++ templates/client/newsletters/subcribe.html | 107 -------- templates/client/popups/russia_cities.html | 1 - 7 files changed, 68 insertions(+), 380 deletions(-) delete mode 100644 templates/client/accounts/mailing_settings.html create mode 100644 templates/client/newsletters/mailing_settings.html delete mode 100644 templates/client/newsletters/subcribe.html diff --git a/apps/accounts/views.py b/apps/accounts/views.py index aa7a209d..02f65870 100644 --- a/apps/accounts/views.py +++ b/apps/accounts/views.py @@ -117,7 +117,7 @@ class GetUserMixin(object): class MailingSettings(GetUserMixin, ContextMixin, AjaxableResponseMixin, CreateUpdateView): form_class = MailingSettingsForm - template_name = 'client/accounts/mailing_settings.html' + template_name = 'client/newsletters/mailing_settings.html' success_url = reverse_lazy('accounts-mailing_settings') def get_success_url(self): @@ -144,16 +144,9 @@ class MailingSettings(GetUserMixin, ContextMixin, AjaxableResponseMixin, CreateU return instance def form_valid(self, form): - # print(form.cleaned_data) - # print(form.errors) - # print(self.request.POST) - # import pdb; pdb.set_trace() return super(MailingSettings, self).form_valid(form) def form_invalid(self, form): - # print(form.cleaned_data) - # print(form.errors) - # print(self.request.POST) return super(MailingSettings, self).form_invalid(form) @@ -614,4 +607,4 @@ class UserSubscribeThemesTagsView(GetUserMixin, TemplateView): def render_to_response(self, context, **response_kwargs): context.pop('view') - return HttpResponse(json.dumps(context), content_type=self.content_type) \ No newline at end of file + return HttpResponse(json.dumps(context), content_type=self.content_type) diff --git a/apps/emencia/django/newsletter/views/expo_views.py b/apps/emencia/django/newsletter/views/expo_views.py index bd05260d..38b97bfc 100644 --- a/apps/emencia/django/newsletter/views/expo_views.py +++ b/apps/emencia/django/newsletter/views/expo_views.py @@ -19,7 +19,7 @@ from city.models import City class SubscribeView(GetUserMixin, ContextMixin, FormView): form_class = ContactForm - template_name = 'client/newsletters/subcribe.html' + template_name = 'client/newsletters/mailing_settings.html' success_url = reverse_lazy('subscription_activation_send') def get_form(self, form_class): @@ -57,7 +57,7 @@ class SubscribeView(GetUserMixin, ContextMixin, FormView): def get_context_data(self, **kwargs): ctx = super(SubscribeView, self).get_context_data(**kwargs) - ctx['mailsettings_object'] = self.get_mailsettings_object() + ctx['object'] = self.get_mailsettings_object() ctx['mailsettings_form'] = MailingSettingsForm( instance=self.get_user() ) @@ -83,7 +83,10 @@ class SubscribeView(GetUserMixin, ContextMixin, FormView): instance.themes.values_list('pk', flat=True)), 'contact': instance, }) - if not instance.subscriber: + if self.request.GET.get('unsibscribe') and instance.subscriber: + instance.unsubscribe() + self.extra_ctx.update({'unsubscribe_success': True}) + elif not instance.subscriber: self.extra_ctx.update({'unsubscribed': True}) return instance diff --git a/templates/client/accounts/mailing_settings.html b/templates/client/accounts/mailing_settings.html deleted file mode 100644 index db4d0f61..00000000 --- a/templates/client/accounts/mailing_settings.html +++ /dev/null @@ -1,259 +0,0 @@ -{% load static i18n %} - - - - - - - {% trans 'Настройте рассылку от Expomap' %} - - - - - - - - - - - {% if user.is_authenticated %} - - {% else %} -
-
-
- +7 (499) 999-12-07 -
    -
  • -
  • -
  • -
  • -
  • -
  • -
-
- - {% blocktrans %}Писковик деловых событий{% endblocktrans %} -
-
- {% endif %} - - -
- {% csrf_token %} - - {% if not user.is_authenticated %} -
-
-

{% trans 'Анонсы выставок' %}
{% trans 'и конференций на ваш e-mail' %}

-

{% trans 'Хотите быть в курсе событий?' %}

-
-

{% trans 'Получайте анонсы выставок и конференций на email каждую среду. Вы можете выбрать несколько интересующих вас тематических направлений.' %} {% trans 'Пример письма' %}

-
-{# {% csrf_token %}#} -
-
-
- {{ form.first_name }} - {{ form.email }} -
- -
-
-{# #} -
-
- {% endif %} - -
-
-

{% trans 'Какие события включать в ваше письмо?' %}

- -
-
-

{% trans 'Ваши темы:' %}

- -
    - {% for theme in object.themes.all %} -
  • - - {{ theme }} - × -
  • - {% endfor %} - - {% for tag in object.tags.all %} -
  • - - {{ tag }} - × -
  • - {% endfor %} -
- {% trans 'Уточнить темы' %} -
- -
-

{% trans 'Ваши гео-фильтры:' %}

- - -
-
-
-
- -
-
-

{% trans 'Включать ли новости / обзоры / статьи в письмо?' %}

- -
-
- {{ form.content_news }} - {{ form.content_news.label_tag }} -

{% trans "Получайте новости выставок и конференций по выбранным тематикам" %}

-
- -
- {{ form.content_overview }} - {{ form.content_overview.label_tag }} -

{% trans "Практические материалы, интервью, кейсы, которые помогут эффективно участвовать в выставках" %}

-
- -
- {{ form.content_articles }} - {{ form.content_articles.label_tag }} -

{% trans "Блог о том, как создавать и продвигать крутые event`ы" %}

-
-
-
-
- -
-
-

{% trans 'Регулярность получения писем' %}

- -
-
-
    - {% for field in form.periodic %} -
  • - -
  • - {% endfor %} -
-
- -
- {% for field in form.periodic_day %} - - {% endfor %} -
-
-
-
- -
-
-
- {% trans 'Нажимая «Подписаться», вы соглашаетесь получать' %}
{% trans 'материалы компании Expomap на свой электронный адрес' %}
- {% trans "Пользовательское соглашение" %} -
- - {% trans 'Не хочу быть в курсе событий (отписаться от всего)' %} -
-
- - - - - - - -
-
- {% include 'client/popups/new_themes.html' %} -
- -
- {% include 'client/popups/russia_cities.html' %} -
- -
- {% include 'client/popups/mailing_settings_countries.html' %} -
- - {% if unsubscribe_success or unsubscribed %} -
- {% include 'client/popups/unsubscribed.html' %} -
- {% endif %} -
- - - - - - - - - diff --git a/templates/client/includes/header.html b/templates/client/includes/header.html index 70c5ab49..076c07b7 100644 --- a/templates/client/includes/header.html +++ b/templates/client/includes/header.html @@ -103,7 +103,7 @@ {% if messages_inbox_count %} {{ messages_inbox_count }} {% endif %} - + diff --git a/templates/client/newsletters/mailing_settings.html b/templates/client/newsletters/mailing_settings.html new file mode 100644 index 00000000..87e96a70 --- /dev/null +++ b/templates/client/newsletters/mailing_settings.html @@ -0,0 +1,59 @@ +{% load static i18n %} + + + + + + + {% trans 'Настройте рассылку от Expomap' %} + + + + + + + + + + + {% if user.is_authenticated %} + + {% else %} +
+
+
+ +7 (499) 999-12-07 +
    +
  • +
  • +
  • +
  • +
  • +
  • +
+
+ + {% blocktrans %}Писковик деловых событий{% endblocktrans %} +
+
+ {% endif %} + +

Страница в разработке

+ + + + + + + + + diff --git a/templates/client/newsletters/subcribe.html b/templates/client/newsletters/subcribe.html deleted file mode 100644 index b0345858..00000000 --- a/templates/client/newsletters/subcribe.html +++ /dev/null @@ -1,107 +0,0 @@ -{% load static i18n %}{% spaceless %} - - - - - - - Expomap - - - - - - - - - - -{# #} - - - - - - - - - - - - -
- {% if user.is_authenticated %} - - {% else %} -
-
-
- +7 (499) 999-12-07 -
    -
  • -
  • -
  • -
  • -
  • -
  • -
-
- - {% blocktrans %}Писковик деловых событий{% endblocktrans %} -
-
- {% endif %} - - -
-
-

{% trans 'Анонсы выставок' %}
{% trans 'и конференций на ваш e-mail' %}

-

{% trans 'Хотите быть в курсе событий?' %}

-
-

{% trans 'Получайте анонсы выставок и конференций на email каждую среду. Вы можете выбрать несколько интересующих вас тематических направлений.' %} {% trans 'Пример письма' %}

-
-
{% csrf_token %} -
-
- {{ form.first_name }} - {{ form.email }} -
- -
-
-
-
- - {% include 'client/includes/accounts/mailing_settings_form.html' with object=mailsettings_object form=mailsettings_form %} - -
- -
-
- {% include 'client/popups/new_themes.html' %} -
- -
- {% include 'client/popups/russia_cities.html' %} -
- -
- {% include 'client/popups/mailing_settings_countries.html' %} -
-
- -{% endspaceless %} diff --git a/templates/client/popups/russia_cities.html b/templates/client/popups/russia_cities.html index e6d687c7..ee170aed 100644 --- a/templates/client/popups/russia_cities.html +++ b/templates/client/popups/russia_cities.html @@ -14,7 +14,6 @@