Commit a3dc7f5a authored by Jelle Besseling's avatar Jelle Besseling

Make newsletter event headers and summary clickable

parent edc1357c
......@@ -11,9 +11,11 @@ class NewsletterItemInline(admin.StackedInline):
"""The inline for the text items in the newsletter"""
model = NewsletterItem
extra = 0
fields = ('order', 'title_en', 'title_nl', 'url', 'description_en',
'description_nl')
class NewsletterEventInline(NewsletterItemInline):
class NewsletterEventInline(admin.StackedInline):
"""The inline for the event items in the newsletter"""
form = NewsletterEventForm
model = NewsletterEvent
......
......@@ -26,7 +26,7 @@ class NewsletterEventForm(forms.ModelForm):
self.fields['event'].required = False
class Meta:
fields = ('order', 'event', 'title_en', 'title_nl',
fields = ('order', 'event', 'title_en', 'title_nl', 'url',
'description_en', 'description_nl',
'where_en', 'where_nl', 'start_datetime', 'end_datetime',
'show_costs_warning', 'price', 'penalty_costs')
......
This diff was suppressed by a .gitattributes entry.
......@@ -5,8 +5,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Thaliawebsite: nieuwsbrieven\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-03 18:14+0100\n"
"PO-Revision-Date: 2019-06-07 15:03+0200\n"
"POT-Creation-Date: 2019-11-06 18:49+0100\n"
"PO-Revision-Date: 2019-11-06 18:50+0100\n"
"Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"Language-Team: Technicie <www@thalia.nu>\n"
"Language: nl\n"
......@@ -14,7 +14,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2.1\n"
"X-Generator: Poedit 2.2.4\n"
#: apps.py
msgid "Newsletters"
......@@ -70,6 +70,14 @@ msgstr "Controleer of alle links absoluut zijn en http(s):// bevatten."
msgid "Please make sure the send date is not in the past."
msgstr "De verzenddatum mag niet in het verleden liggne."
#: models.py
msgid "URL"
msgstr "URL"
#: models.py
msgid "If filled, it will make the title a link to this URL"
msgstr "Als je dit invult zal de titel verwijzen naar de deze URL"
#: models.py
msgid "Description"
msgstr "Beschrijving"
......@@ -78,6 +86,10 @@ msgstr "Beschrijving"
msgid "order"
msgstr "volgorde"
#: models.py
msgid "Please make sure all urls are absolute and start with http(s)://."
msgstr "Controleer of alle links absoluut zijn en met http(s):// beginnen."
#: models.py templates/newsletters/email.html templates/newsletters/email.txt
msgid "Where"
msgstr "Waar"
......
# Generated by Django 2.2.6 on 2019-11-06 18:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('newsletters', '0009_auto_20191103_1821'),
]
operations = [
migrations.AddField(
model_name='newslettercontent',
name='url',
field=models.URLField(blank=True, help_text='If filled, it will make the title a link to this URL', null=True, verbose_name='URL'),
),
]
......@@ -99,6 +99,13 @@ class NewsletterContent(models.Model, metaclass=ModelTranslateMeta):
null=False,
)
url = models.URLField(
verbose_name=_('URL'),
blank=True,
null=True,
help_text=_('If filled, it will make the title a link to this URL'),
)
description = MultilingualField(
HTMLField,
verbose_name=_('Description'),
......@@ -123,12 +130,12 @@ class NewsletterContent(models.Model, metaclass=ModelTranslateMeta):
if url in self.description_nl:
errors.update({
'description_nl': _('Please make sure all urls are absolute '
'and contain http(s)://.')
'and start with http(s)://.')
})
if url in self.description_en:
errors.update({
'description_en': _('Please make sure all urls are absolute '
'and contain http(s)://.')
'and start with http(s)://.')
})
if errors:
......
......@@ -59,6 +59,8 @@ django.jQuery(function () {
.val(data['location']);
if (lang === 'en') {
$('#id_newsletterevent_set-' + id + '-url')
.val(window.location.origin + '/events/' + data['pk'] + '/');
$('#id_newsletterevent_set-' + id + '-price')
.val(data['price']);
$('#id_newsletterevent_set-' + id + '-penalty_costs')
......
......@@ -68,7 +68,7 @@
{% for row in agenda_events|rows_distributed:2 %}
<td style="vertical-align: top;">
{% for item in row %}
<li style="font-family: Arial, sans-serif;"><i>{{ item.title }} - {{ item.start|date:"d F" }}</i></li>
<li style="font-family: Arial, sans-serif;"><i><a href="{% baseurl %}{% url 'events:event' item.pk %}" style="text-decoration: none; color: {{ primary_color }};">{{ item.title }} - {{ item.start|date:"d F" }}</a></i></li>
{% endfor %}
</td>
{% endfor %}
......@@ -81,7 +81,11 @@
{% for item in newsletter.newslettercontent_set.all %}
<tr>
<td colspan="2" style="{{ item_tr_style }}">
{% if item.url %}
<h2 style="{{ item_h2_style }}"><a href="{{ item.url }}" style="text-decoration: none; color: inherit;">{{ item.title.upper }}</a></h2>
{% else %}
<h2 style="{{ item_h2_style }}">{{ item.title.upper }}</h2>
{% endif %}
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment