diff options
41 files changed, 540 insertions, 4 deletions
diff --git a/app/lttr/admin.py b/app/lttr/admin.py index 1b919d6..4ca30ce 100644 --- a/app/lttr/admin.py +++ b/app/lttr/admin.py @@ -1,7 +1,8 @@ from django.contrib import admin -from .models import NewsletterMailing, Subscriber +from utils.widgets import AdminImageWidget, LGEntryForm +from .models import NewsletterMailing, Subscriber @admin.register(Subscriber) class SubscriberAdmin(admin.ModelAdmin): @@ -11,3 +12,31 @@ class SubscriberAdmin(admin.ModelAdmin): class Media: js = ('next-prev-links.js',) + + +@admin.register(NewsletterMailing) +class NewsletterMailingAdmin(admin.ModelAdmin): + form = LGEntryForm + list_display = ('title', 'pub_date', 'status') + fieldsets = ( + ('Entry', { + 'fields': ( + 'title', + 'body_markdown', + ('pub_date', 'status'), + 'slug', + 'featured_image', + ), + 'classes': ( + 'show', + 'extrapretty', + 'wide' + ) + } + ), + ) + class Media: + js = ('image-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } diff --git a/app/lttr/migrations/0005_auto_20200205_1606.py b/app/lttr/migrations/0005_auto_20200205_1606.py new file mode 100644 index 0000000..0be644e --- /dev/null +++ b/app/lttr/migrations/0005_auto_20200205_1606.py @@ -0,0 +1,31 @@ +# Generated by Django 2.1.2 on 2020-02-05 16:06 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0019_auto_20190704_0903'), + ('lttr', '0004_auto_20190212_1529'), + ] + + operations = [ + migrations.AddField( + model_name='newslettermailing', + name='body_html', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='newslettermailing', + name='body_markdown', + field=models.TextField(default='tk'), + preserve_default=False, + ), + migrations.AddField( + model_name='newslettermailing', + name='featured_image', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + ), + ] diff --git a/app/lttr/models.py b/app/lttr/models.py index ec5e897..4ab6030 100644 --- a/app/lttr/models.py +++ b/app/lttr/models.py @@ -12,6 +12,7 @@ from django.utils.crypto import get_random_string from taggit.managers import TaggableManager from taxonomy.models import TaggedItems +from photos.models import LuxImage, LuxImageSize # Possible actions that user can perform @@ -101,7 +102,10 @@ class NewsletterMailing(models.Model): """ A model for Newletter Mailings, the things actually sent out """ title = models.CharField(max_length=250) slug = models.SlugField(unique_for_date='pub_date', blank=True) + body_html = models.TextField(blank=True) + body_markdown = models.TextField() pub_date = models.DateTimeField() + featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) tags = TaggableManager(through=TaggedItems, blank=True, help_text='Topics Covered') PUB_STATUS = ( (0, 'Not Published'), @@ -120,8 +124,20 @@ class NewsletterMailing(models.Model): return reverse("newsletter:mailing-detail", kwargs={"slug": self.slug}) def save(self, *args, **kwargs): - if not self.id: + created = self.pk is None + if not created: + md = render_images(self.body_markdown) + self.body_html = markdown_to_html(md) self.date_created = timezone.now() + if created and not self.featured_image: + self.featured_image = LuxImage.objects.latest() + old = type(self).objects.get(pk=self.pk) if self.pk else None + if old and old.featured_image != self.featured_image: # Field has changed + s = LuxImageSize.objects.get(name="featured_jrnl") + ss = LuxImageSize.objects.get(name="picwide-med") + self.featured_image.sizes.add(s) + self.featured_image.sizes.add(ss) + self.featured_image.save() super(NewsletterMailing, self).save() @@ -298,8 +314,6 @@ class Subscriber(models.Model): def get_address(name, email): - # Converting name to ascii for compatibility with django < 1.9. - # Remove this when django 1.8 is no longer supported. if name: return u'%s <%s>' % (name, email) else: diff --git a/design/templates/lttr/confirm_activate.html b/app/lttr/templates/lttr/confirm_activate.html index d67ee1b..d67ee1b 100644 --- a/design/templates/lttr/confirm_activate.html +++ b/app/lttr/templates/lttr/confirm_activate.html diff --git a/design/templates/lttr/message/subscribe.html b/app/lttr/templates/lttr/message/subscribe.html index 3ed34db..3ed34db 100644 --- a/design/templates/lttr/message/subscribe.html +++ b/app/lttr/templates/lttr/message/subscribe.html diff --git a/design/templates/lttr/message/subscribe.txt b/app/lttr/templates/lttr/message/subscribe.txt index 2af5378..2af5378 100644 --- a/design/templates/lttr/message/subscribe.txt +++ b/app/lttr/templates/lttr/message/subscribe.txt diff --git a/design/templates/lttr/message/subscribe_subject.txt b/app/lttr/templates/lttr/message/subscribe_subject.txt index f4660e0..f4660e0 100644 --- a/design/templates/lttr/message/subscribe_subject.txt +++ b/app/lttr/templates/lttr/message/subscribe_subject.txt diff --git a/design/templates/lttr/message/unsubscribe.html b/app/lttr/templates/lttr/message/unsubscribe.html index 4b1a86b..4b1a86b 100644 --- a/design/templates/lttr/message/unsubscribe.html +++ b/app/lttr/templates/lttr/message/unsubscribe.html diff --git a/design/templates/lttr/message/unsubscribe.txt b/app/lttr/templates/lttr/message/unsubscribe.txt index ab31fa5..ab31fa5 100644 --- a/design/templates/lttr/message/unsubscribe.txt +++ b/app/lttr/templates/lttr/message/unsubscribe.txt diff --git a/design/templates/lttr/message/unsubscribe_subject.txt b/app/lttr/templates/lttr/message/unsubscribe_subject.txt index 49c68ef..49c68ef 100644 --- a/design/templates/lttr/message/unsubscribe_subject.txt +++ b/app/lttr/templates/lttr/message/unsubscribe_subject.txt diff --git a/design/templates/lttr/subscribed.html b/app/lttr/templates/lttr/subscribed.html index 18ad151..18ad151 100644 --- a/design/templates/lttr/subscribed.html +++ b/app/lttr/templates/lttr/subscribed.html diff --git a/design/templates/lttr/subscriber_form.html b/app/lttr/templates/lttr/subscriber_form.html index 83e1e28..83e1e28 100644 --- a/design/templates/lttr/subscriber_form.html +++ b/app/lttr/templates/lttr/subscriber_form.html diff --git a/app/lttr/views.py b/app/lttr/views.py index 0d3dbea..79b8e72 100644 --- a/app/lttr/views.py +++ b/app/lttr/views.py @@ -90,3 +90,14 @@ class ConfirmSubscriptionView(DetailView): if obj.subscribed is False: obj.update('subscribe') return obj + + +class UnsubscribeRequestView(DetailView): + model = Subscriber + template_name = "lttr/unsubscribe.html" + + def get_object(self): + obj = Subscriber.objects.get(newsletter__slug=self.kwargs['slug']) + if obj.subscribed is True: + obj.update('unsubscribe') + return obj diff --git a/design/templates/newsletter/common.html b/design/templates/newsletter/common.html new file mode 100644 index 0000000..20ac822 --- /dev/null +++ b/design/templates/newsletter/common.html @@ -0,0 +1,15 @@ +{% load i18n %} +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>{% block title %}{% trans "Newsletter" %}{% endblock title %}</title> + {% block header %} + {% endblock header %} + </head> + + <body> + {% block body %} + {% endblock body %} + </body> +</html> diff --git a/design/templates/newsletter/message/message.html b/design/templates/newsletter/message/message.html new file mode 100644 index 0000000..8929b67 --- /dev/null +++ b/design/templates/newsletter/message/message.html @@ -0,0 +1,32 @@ +{% load thumbnail i18n %}<!DOCTYPE html> + +<html> +<head> + <meta charset="utf-8"> + <title>{{ newsletter.title }}: {{ message.title }}</title> +</head> +<body> + <h1>{{ newsletter.title }}</h1> + <h2>{{ message.title }}</h2> + {% for article in message.articles.all %} + <h3>{{ article.title }}</h3> + + {% thumbnail article.image "200x200" as image %} + <img src="http://{{ site.domain }}{{ image.url }}" width="{{ image.width }}" height="{{ image.height }}"> + {% endthumbnail %} + + <div>{{ article.text|safe }}</div> + + {% if article.url %} + <div><a href="{{ article.url }}">{% trans "Read more" %}</a></div> + {% endif %} + {% endfor %} + + <ul> + {% if submission.publish %} + <li><a href="http://{{ site.domain }}{{ submission.get_absolute_url }}">{% trans "Read message online" %}</a></li> + {% endif %} + <li><a href="http://{{ site.domain }}{% url "newsletter_unsubscribe_request" newsletter.slug %}">{% trans "Unsubscribe" %}</a></li> + </ul> +</body> +</html> diff --git a/design/templates/newsletter/message/message.txt b/design/templates/newsletter/message/message.txt new file mode 100644 index 0000000..ffaab98 --- /dev/null +++ b/design/templates/newsletter/message/message.txt @@ -0,0 +1,15 @@ +{% load i18n %}++++++++++++++++++++ + +{{ newsletter.title }}: {{ message.title }} + +++++++++++++++++++++ + +{% for article in message.articles.all %} +{{ article.title }} +{{ article.text|striptags|safe }} + +{% endfor %} + +++++++++++++++++++++ + +{% trans "Unsubscribe:" %} http://{{ site }}{% url "newsletter_unsubscribe_request" newsletter.slug %} diff --git a/design/templates/newsletter/message/message_subject.txt b/design/templates/newsletter/message/message_subject.txt new file mode 100644 index 0000000..00aa450 --- /dev/null +++ b/design/templates/newsletter/message/message_subject.txt @@ -0,0 +1 @@ +{{ newsletter.title }} - {{ message.title }}
\ No newline at end of file diff --git a/design/templates/newsletter/message/subscribe.html b/design/templates/newsletter/message/subscribe.html new file mode 100644 index 0000000..088a3d0 --- /dev/null +++ b/design/templates/newsletter/message/subscribe.html @@ -0,0 +1,20 @@ +{% load i18n %}<!DOCTYPE html> + +<html> +<head> + <meta charset="utf-8"> + <title>{% blocktrans with title=newsletter.title %}Subscription to {{ title }}{% endblocktrans %} +</title> +</head> +<body> +{% blocktrans with name=subscription.name title=newsletter.title domain=site.domain url=subscription.subscribe_activate_url %}Dear {{ name }}, + +you, or someone in your name requested a subscription to {{ title }}. + +If you would like to confirm your subscription, please follow this activation link: +http://{{ domain }}{{ url }} + +Kind regards,{% endblocktrans %} +{{ newsletter.sender }} +</body> +</html> diff --git a/design/templates/newsletter/message/subscribe.txt b/design/templates/newsletter/message/subscribe.txt new file mode 100644 index 0000000..1f334f2 --- /dev/null +++ b/design/templates/newsletter/message/subscribe.txt @@ -0,0 +1,9 @@ +{% load i18n %}{% blocktrans with name=subscription.name title=newsletter.title domain=site.domain url=subscription.subscribe_activate_url %}Dear {{ name }}, + +you, or someone in your name requested a subscription to {{ title }}. + +If you would like to confirm your subscription, please follow this activation link: +http://{{ domain }}{{ url }} + +Kind regards,{% endblocktrans %} +{{ newsletter.sender }} diff --git a/design/templates/newsletter/message/subscribe_subject.txt b/design/templates/newsletter/message/subscribe_subject.txt new file mode 100644 index 0000000..f61b228 --- /dev/null +++ b/design/templates/newsletter/message/subscribe_subject.txt @@ -0,0 +1 @@ +{% load i18n %}{{ newsletter.title }} - {% trans "Confirm subscription" %} diff --git a/design/templates/newsletter/message/unsubscribe.html b/design/templates/newsletter/message/unsubscribe.html new file mode 100644 index 0000000..4b1a86b --- /dev/null +++ b/design/templates/newsletter/message/unsubscribe.html @@ -0,0 +1,19 @@ +{% load i18n %}<!DOCTYPE html> + +<html> +<head> + <meta charset="utf-8"> + <title>{% blocktrans with title=newsletter.title %}Unsubscription from {{ title }}{% endblocktrans %}</title> +</head> +<body> +{% blocktrans with name=subscription.name title=newsletter.title domain=site.domain url=subscription.unsubscribe_activate_url %}Dear {{ name }}, + +you, or someone in your name requested unsubscription from {{ title }}. + +If you would like to confirm your unsubscription, please follow this activation link: +http://{{ domain }}{{ url }} + +Kind regards,{% endblocktrans %} +{{ newsletter.sender }} +</body> +</html> diff --git a/design/templates/newsletter/message/unsubscribe.txt b/design/templates/newsletter/message/unsubscribe.txt new file mode 100644 index 0000000..ab31fa5 --- /dev/null +++ b/design/templates/newsletter/message/unsubscribe.txt @@ -0,0 +1,9 @@ +{% load i18n %}{% blocktrans with name=subscription.name title=newsletter.title domain=site.domain url=subscription.unsubscribe_activate_url %}Dear {{ name }}, + +you, or someone in your name requested unsubscription from {{ title }}. + +If you would like to confirm your unsubscription, please follow this activation link: +http://{{ domain }}{{ url }} + +Kind regards,{% endblocktrans %} +{{ newsletter.sender }} diff --git a/design/templates/newsletter/message/unsubscribe_subject.txt b/design/templates/newsletter/message/unsubscribe_subject.txt new file mode 100644 index 0000000..49c68ef --- /dev/null +++ b/design/templates/newsletter/message/unsubscribe_subject.txt @@ -0,0 +1 @@ +{% load i18n %}{{ newsletter.title }} - {% trans "Confirm unsubscription" %} diff --git a/design/templates/newsletter/message/update.html b/design/templates/newsletter/message/update.html new file mode 100644 index 0000000..e46235d --- /dev/null +++ b/design/templates/newsletter/message/update.html @@ -0,0 +1,19 @@ +{% load i18n %}<!DOCTYPE html> + +<html> +<head> + <meta charset="utf-8"> + <title>{% blocktrans with title=newsletter.title %}Update of subscription to {{ title }}{% endblocktrans %}</title> +</head> +<body> +{% blocktrans with name=subscription.name title=newsletter.title domain=site.domain url=subscription.update_activate_url %}Dear {{ name }}, + +you, or someone in your name requested updating your personal information for {{ title }}. + +To make changes to your information in our database, please follow this activation link: +http://{{ domain }}{{ url }} + +Kind regards,{% endblocktrans %} +{{ newsletter.sender }} +</body> +</html> diff --git a/design/templates/newsletter/message/update.txt b/design/templates/newsletter/message/update.txt new file mode 100644 index 0000000..aa50b19 --- /dev/null +++ b/design/templates/newsletter/message/update.txt @@ -0,0 +1,9 @@ +{% load i18n %}{% blocktrans with name=subscription.name title=newsletter.title domain=site.domain url=subscription.update_activate_url %}Dear {{ name }}, + +you, or someone in your name requested updating your personal information for {{ title }}. + +To make changes to your information in our database, please follow this activation link: +http://{{ domain }}{{ url }} + +Kind regards,{% endblocktrans %} +{{ newsletter.sender }} diff --git a/design/templates/newsletter/message/update_subject.txt b/design/templates/newsletter/message/update_subject.txt new file mode 100644 index 0000000..217d5f6 --- /dev/null +++ b/design/templates/newsletter/message/update_subject.txt @@ -0,0 +1 @@ +{% load i18n %}{{ newsletter.title }} - {% trans "Update information" %} diff --git a/design/templates/newsletter/newsletter_detail.html b/design/templates/newsletter/newsletter_detail.html new file mode 100644 index 0000000..fe23a1f --- /dev/null +++ b/design/templates/newsletter/newsletter_detail.html @@ -0,0 +1,30 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter detail" %}{% endblock title %} + +{% block body %} +<table> + <tr> + <th>{% trans "Newsletter" %} {{ object.title }}</th> + </tr> + <tr> + <td><a href="{% url "newsletter_subscribe_request" object.slug %}">{% trans "Subscribe" %}</a></td> + </tr> + {% if not user.is_authenticated %} + <tr> + <td><a href="{% url "newsletter_update_request" object.slug %}">{% trans "Update" %}</a></td> + </tr> + {% endif %} + <tr> + <td><a href="{% url "newsletter_unsubscribe_request" object.slug %}">{% trans "Unsubscribe" %}</a></td> + </tr> + <tr> + <td><a href="{% url "newsletter_archive" object.slug %}">{% trans "Archive" %}</a></td> + </tr> + <tr> + <td><a href="../">{% trans "Back to list" %}</a></td> + </tr> +</table> +{% endblock body %} diff --git a/design/templates/newsletter/newsletter_list.html b/design/templates/newsletter/newsletter_list.html new file mode 100644 index 0000000..2b48fa2 --- /dev/null +++ b/design/templates/newsletter/newsletter_list.html @@ -0,0 +1,41 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter list" %}{% endblock title %} + +{% block body %} +{% if user.is_authenticated %} +<form method="POST" action=""> + {% csrf_token %} + {{ formset.management_form }} + <table> + <tr> + <th>{% trans "Newsletter" %}</th> + {% if user %} + <th>{% trans "Subscribe" %}</th> + {% endif %} + </tr> + {% for form in formset.forms %} + <tr> + <td>{{ form.id }}{{ form.newsletter }} +<a href="{% url "newsletter_detail" form.instance.newsletter.slug %}">{{ form.instance.newsletter.title }}</a></td> + <td>{{ form.subscribed }}</td> + </tr> + {% endfor %} + </table> + <p><input id="id_submit" name="submit" value="{% trans "Update subscriptions" %}" type="submit" /></p> +</form> +{% else %} +<table> + <tr> + <th>{% trans "Newsletter" %}</th> + </tr> + {% for newsletter in object_list %} + <tr> + <td><a href="{% url "newsletter_detail" newsletter.slug %}">{{ newsletter.title }}</a></td> + </tr> + {% endfor %} +</table> +{% endif %} +{% endblock body %} diff --git a/design/templates/newsletter/submission_archive.html b/design/templates/newsletter/submission_archive.html new file mode 100644 index 0000000..771b995 --- /dev/null +++ b/design/templates/newsletter/submission_archive.html @@ -0,0 +1,21 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter archive" %}{% endblock title %} + +{% block body %} +<table> + <tr> + <th>{% trans "Newsletter archive" %} {{ newsletter.title }}</th> + </tr> + {% for submission in latest %} + <tr> + <td><a href="{{ submission.get_absolute_url }}">{{ submission }}</a></td> + </tr> + {% endfor %} + <tr> + <td><a href="../">{% trans "Back to list" %}</a></td> + </tr> +</table> +{% endblock body %} diff --git a/design/templates/newsletter/subscription_activate.html b/design/templates/newsletter/subscription_activate.html new file mode 100644 index 0000000..558013a --- /dev/null +++ b/design/templates/newsletter/subscription_activate.html @@ -0,0 +1,15 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1> + + <form enctype="multipart/form-data" method="post" action="."> + {% csrf_token %} + {{ form.as_p }} + <p><input id="id_submit" name="submit" value="{% trans "Activate" %}" type="submit" /></p> + </form> +{% endblock body %} diff --git a/design/templates/newsletter/subscription_subscribe.html b/design/templates/newsletter/subscription_subscribe.html new file mode 100644 index 0000000..a2716a1 --- /dev/null +++ b/design/templates/newsletter/subscription_subscribe.html @@ -0,0 +1,25 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter subscribe" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter subscribe" %} {{ newsletter.title }}</h1> + + {% if error %} + <p>{% trans "Due to a technical error we were not able to submit your confirmation email. This could be because your email address is invalid." %}</p> + + {% comment %} Replace the the following dummy with a valid email address and remove this comment. + + <p>{% trans "If the error persists, please don't hesitate to contact us at the following email address:" %} <a href="newsletter@luxagraf.net">newsletter@luxagraf.net</a></p> + + {% endcomment %} + {% else %} + <form enctype="multipart/form-data" method="post" action="."> + {% csrf_token %} + {{ form.as_p }} + <p><input id="id_submit" name="submit" value="{% trans "Subscribe" %}" type="submit" /></p> + </form> + {% endif %} +{% endblock body %} diff --git a/design/templates/newsletter/subscription_subscribe_activated.html b/design/templates/newsletter/subscription_subscribe_activated.html new file mode 100644 index 0000000..c8519d7 --- /dev/null +++ b/design/templates/newsletter/subscription_subscribe_activated.html @@ -0,0 +1,11 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1> + + <p>{% trans "Your subscription has successfully been activated." %}</p> +{% endblock body %} diff --git a/design/templates/newsletter/subscription_subscribe_email_sent.html b/design/templates/newsletter/subscription_subscribe_email_sent.html new file mode 100644 index 0000000..79eea11 --- /dev/null +++ b/design/templates/newsletter/subscription_subscribe_email_sent.html @@ -0,0 +1,11 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter subscribe" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter subscribe" %} {{ newsletter.title }}</h1> + + <p>{% trans "Your subscription request was successfully received and an activation email has been sent to you. In that email you will find a link which you need to follow in order to activate your subscription." %}</p> +{% endblock body %} diff --git a/design/templates/newsletter/subscription_subscribe_user.html b/design/templates/newsletter/subscription_subscribe_user.html new file mode 100644 index 0000000..f0bbf3d --- /dev/null +++ b/design/templates/newsletter/subscription_subscribe_user.html @@ -0,0 +1,25 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter subscribe" %}{% endblock title %} + +{% block body %} +<h1>{% trans "Newsletter subscribe" %} {{ newsletter.title }}</h1> + +<p>Welcome, {{ user }}!</p> + +{% if messages %} +<ul> + {% for message in messages %} + <li>{{ message }}</li> + {% endfor %} +</ul> +{% else %} +{% trans "Do you want to subscribe to this newsletter?" %} +<form enctype="multipart/form-data" method="post" action="{% url "newsletter_subscribe_confirm" newsletter.slug %}"> + {% csrf_token %} + <p><input id="id_submit" name="submit" value="{% trans "Subscribe" %}" type="submit" /></p> +</form> +{% endif %} +{% endblock body %} diff --git a/design/templates/newsletter/subscription_unsubscribe.html b/design/templates/newsletter/subscription_unsubscribe.html new file mode 100644 index 0000000..022ba4b --- /dev/null +++ b/design/templates/newsletter/subscription_unsubscribe.html @@ -0,0 +1,25 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter unsubscribe" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter unsubscribe" %} {{ newsletter.title }}</h1> + + {% if error %} + <p>{% trans "Due to a technical error we were not able to submit your confirmation email. This could be because your email address is invalid." %}</p> + + {% comment %} Replace the the following dummy with a valid email address and remove this comment. + + <p>{% trans "If the error persists, please don't hesitate to contact us at the following email address:" %} <a href="mailto:info@foobar.com">info@foobar.com</a></p> + + {% endcomment %} + {% else %} + <form enctype="multipart/form-data" method="post" action="."> + {% csrf_token %} + {{ form.as_p }} + <p><input id="id_submit" name="submit" value="{% trans "Unsubscribe" %}" type="submit" /></p> + </form> + {% endif %} +{% endblock body %} diff --git a/design/templates/newsletter/subscription_unsubscribe_activated.html b/design/templates/newsletter/subscription_unsubscribe_activated.html new file mode 100644 index 0000000..65628c5 --- /dev/null +++ b/design/templates/newsletter/subscription_unsubscribe_activated.html @@ -0,0 +1,11 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1> + + <p>{% trans "You have successfully been unsubscribed." %}</p> +{% endblock body %} diff --git a/design/templates/newsletter/subscription_unsubscribe_email_sent.html b/design/templates/newsletter/subscription_unsubscribe_email_sent.html new file mode 100644 index 0000000..19d00b8 --- /dev/null +++ b/design/templates/newsletter/subscription_unsubscribe_email_sent.html @@ -0,0 +1,11 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter unsubscribe" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter unsubscribe" %} {{ newsletter.title }}</h1> + + <p>{% trans "Your unsubscription request has successfully been received. An email has been sent to you with a link you need to follow in order to confirm your unsubscription." %}</p> +{% endblock body %} diff --git a/design/templates/newsletter/subscription_unsubscribe_user.html b/design/templates/newsletter/subscription_unsubscribe_user.html new file mode 100644 index 0000000..5bc81dc --- /dev/null +++ b/design/templates/newsletter/subscription_unsubscribe_user.html @@ -0,0 +1,27 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter unsubscribe" %}{% endblock title %} + +{% block body %} +<h1>{% trans "Newsletter unsubscribe" %} {{ newsletter.title }}</h1> + +<p>Welcome, {{ user }}!</p> + +{% if messages %} +<ul> + {% for message in messages %} + <li>{{ message }}</li> + {% endfor %} +</ul> +{% else %} + +{% trans "Do you want to unsubscribe from this newsletter?" %} +<form enctype="multipart/form-data" method="post" action="{% url "newsletter_unsubscribe_confirm" newsletter.slug %}"> + {% csrf_token %} + <p><input id="id_submit" name="submit" value="{% trans "Unsubscribe" %}" type="submit" /></p> +</form> +{% endif %} + +{% endblock body %} diff --git a/design/templates/newsletter/subscription_update.html b/design/templates/newsletter/subscription_update.html new file mode 100644 index 0000000..fe83797 --- /dev/null +++ b/design/templates/newsletter/subscription_update.html @@ -0,0 +1,25 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter update" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter update" %} {{ newsletter.title }}</h1> + + {% if error %} + <p>{% trans "Due to a technical error we were not able to submit your confirmation email. This could be because your email address is invalid." %}</p> + + {% comment %} Replace the the following dummy with a valid email address and remove this comment. + + <p>{% trans "If the error persists, please don't hesitate to contact us at the following email address:" %} <a href="mailto:info@foobar.com">info@foobar.com</a></p> + + {% endcomment %} + {% else %} + <form enctype="multipart/form-data" method="post" action="."> + {% csrf_token %} + {{ form.as_p }} + <p><input id="id_submit" name="submit" value="{% trans "Update subscription" %}" type="submit" /></p> + </form> + {% endif %} +{% endblock body %} diff --git a/design/templates/newsletter/subscription_update_activated.html b/design/templates/newsletter/subscription_update_activated.html new file mode 100644 index 0000000..65b0298 --- /dev/null +++ b/design/templates/newsletter/subscription_update_activated.html @@ -0,0 +1,11 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter" %} {{ newsletter.title }} {{ action }} {% trans "activate" %}</h1> + + <p>{% trans "Your subscription has successfully been updated." %}</p> +{% endblock body %} diff --git a/design/templates/newsletter/subscription_update_email_sent.html b/design/templates/newsletter/subscription_update_email_sent.html new file mode 100644 index 0000000..b740d18 --- /dev/null +++ b/design/templates/newsletter/subscription_update_email_sent.html @@ -0,0 +1,11 @@ +{% extends "newsletter/common.html" %} + +{% load i18n %} + +{% block title %}{% trans "Newsletter update" %}{% endblock title %} + +{% block body %} + <h1>{% trans "Newsletter update" %} {{ newsletter.title }}</h1> + + <p>{% trans "Your update request was successfully received and an activation email has been sent to you. In that email you will find a link which you need to follow in order to update your subscription." %}</p> +{% endblock body %} |