Skip to content

Commit

Permalink
improve layout for newsletter (#3598)
Browse files Browse the repository at this point in the history
* improve layout for newsletter

* Tune sizes a bit

---------

Co-authored-by: Dirk Doesburg <[email protected]>
  • Loading branch information
rodepanda7 and DeD1rk authored Feb 20, 2024
1 parent 8b0f579 commit 78a1bc5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 4 additions & 3 deletions website/newsletters/services.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import base64
import logging
import math
from io import BytesIO

from django.core.files.base import ContentFile
Expand Down Expand Up @@ -92,10 +91,12 @@ def send_newsletter(newsletter):


def split_local_partners():
all_local_partners = Partner.objects.filter(is_local_partner=True).order_by("?")
all_local_partners = Partner.objects.filter(
is_local_partner=True, is_active=True
).order_by("?")
local_partner_count = len(all_local_partners)
local_partners = []
for i in range(math.floor(local_partner_count / 2)):
for i in range(local_partner_count // 2):
local_partners.append(
[all_local_partners[i * 2], all_local_partners[i * 2 + 1]]
)
Expand Down
4 changes: 2 additions & 2 deletions website/newsletters/templates/newsletters/email.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ <h2 style="{{ item_h2_style }}">{{ item.title.upper }}</h2>
<td align="center" style="color: black; font-size: 12px;">
<p style="margin: 10px; font-family: 'Gill Sans', 'Trebuchet MS', sans-serif;">
<a href="{{ main_partner.link }}">
<img src="{% thumbnail main_partner.logo "fit_medium" absolute_url=True %}" height="95" style="height: 95px;" alt="{{ main_partner.name }}"/>
<img src="{% thumbnail main_partner.logo "fit_medium_pad" absolute_url=True %}" height="100" width="240" style="height: 100px; width: 240px;" alt="{{ main_partner.name }}"/>
</a><br>
OUR MAIN PARTNER
</p>
Expand All @@ -232,7 +232,7 @@ <h2 style="{{ item_h2_style }}">{{ item.title.upper }}</h2>
<td align="center" style="color: black; font-size: 12px;">
<p style="margin: 10px; font-family: 'Gill Sans', 'Trebuchet MS', sans-serif;">
<a href="{{ local_partner.link }}">
<img src="{% thumbnail local_partner.logo "fit_medium" absolute_url=True %}" height="70" style="height: 70px; margin-bottom: 25px" alt="{{ local_partner.name }}"/>
<img src="{% thumbnail local_partner.logo "fit_small_pad" absolute_url=True %}" height="75" width="180" style="height: 75px; width: 180px; margin-bottom: 25px" alt="{{ local_partner.name }}"/>
</a><br>
OUR LOCAL PARTNER
</p>
Expand Down
10 changes: 10 additions & 0 deletions website/thaliawebsite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,16 @@ def show_toolbar(request):
},
],
},
"fit_small_pad": {
"FORMAT": "webp",
"PROCESSORS": [
{
"PATH": "utils.media.processors.thumbnail",
"size": (360, 150),
"mode": "pad",
},
],
},
"fit_large": {
"FORMAT": "webp",
"PROCESSORS": [
Expand Down

0 comments on commit 78a1bc5

Please sign in to comment.