Skip to content

Commit c34d82c

Browse files
committed
feat(template): add logo on email templates
1 parent e479746 commit c34d82c

File tree

7 files changed

+37
-19
lines changed

7 files changed

+37
-19
lines changed

apps/common/templatetags/__init__.py

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from django import template
2+
from django.conf import settings
3+
from django.templatetags.static import static
4+
5+
register = template.Library()
6+
7+
8+
@register.filter(is_safe=True)
9+
def static_full_path(path):
10+
static_path = static(path)
11+
# Domain from URL object
12+
domain = f"{settings.APP_DOMAIN.scheme}://{settings.APP_DOMAIN.hostname}"
13+
if settings.APP_DOMAIN.port:
14+
domain += f":{settings.APP_DOMAIN.port}"
15+
return f"{domain}{static_path}"

main/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
APP_ENVIRONMENT = env("APP_ENVIRONMENT").upper()
7777
APP_TYPE = env("APP_TYPE").upper()
7878
SECRET_KEY = env("DJANGO_SECRET_KEY")
79-
79+
STATICFILES_DIRS = (str(BASE_DIR.joinpath("static")),)
8080
DEBUG = env("DEBUG")
8181

8282
ALLOWED_HOSTS = [

static/images/rc-select-logo.png

7.07 KB
Loading

templates/email/base.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
1+
2+
<html>
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>{% block title %}RC Select{% endblock %}</title>
7-
87
<style>
98
body {
109
margin: 0;

templates/email/contact_request.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{% extends "email/base.html" %}
22

33
{% block content %}
4+
{% load custom_tags %}
45
<div style="margin-bottom: 20px;">
5-
<!-- TODO: Add Logo link here -->
6-
<img src="../assets/logos.png" alt="logos" style="width: 100%; max-width: 600px; height: auto; display: block;">
6+
<img
7+
alt="image description" height="auto"
8+
src="{{ 'images/rc-select-logo.png' | static_full_path }}"
9+
style="border:0;display:block;outline:none;text-decoration:none;height:auto;width:30%;font-size:14px;"
10+
width="10"
11+
/>
712
</div>
813

914
<p style="font-size: 14px; margin-bottom: 15px; font-weight: bold; font-family: Arial, sans-serif; color: #000000;">
@@ -18,11 +23,11 @@
1823
<li style="margin-bottom: 8px;">
1924
<strong style="color: #000000;">Name:</strong> {{ name }}
2025
</li>
21-
26+
2227
<li style="margin-bottom: 8px;">
2328
<strong style="color: #000000;">Email:</strong> {{ email }}
2429
</li>
25-
30+
2631
<li style="margin-bottom: 8px;">
2732
<strong style="color: #000000;">National Society:</strong> {{ national_society }}
2833
</li>

templates/email/request_demo.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
{% extends "email/base.html" %}
22

33
{% block content %}
4-
4+
{% load custom_tags %}
55
<div style="margin-bottom: 20px;">
6-
<!-- TODO: Add Logo link here -->
7-
<img src="../assets/logos.png" alt="logos" style="width: 100%; max-width: 600px; height: auto; display: block;">
6+
<img
7+
alt="image description" height="auto"
8+
src="{{ 'images/rc-select-logo.png' | static_full_path }}"
9+
style="border:0;display:block;outline:none;text-decoration:none;height:auto;width:30%;font-size:14px;"
10+
width="10"
11+
/>
812
</div>
913

1014
<p style="font-size: 14px; margin-bottom: 15px; font-weight: bold; font-family: Arial, sans-serif; color: #000000;">
1115
You got a new Request for Demo!
1216
</p>
1317

14-
<!-- TODO: Add tool owner name here -->
15-
<div style="font-size: 14px; margin-bottom: 15px; font-family: Arial, sans-serif; color: #000000;">
16-
Hi {{name}},
17-
</div>
18-
1918
<!-- TODO: Add tool name here -->
2019
<div style="font-size: 14px; margin-bottom: 15px; font-family: Arial, sans-serif; color: #000000;">
21-
You've received a new demo request from a user through {{name}}:
20+
You've received a new demo request from a user through {{tool}}
2221
</div>
2322

2423
<div style="font-size: 14px; margin-bottom: 15px; font-family: Arial, sans-serif; color: #000000;">
@@ -29,11 +28,11 @@
2928
<li style="margin-bottom: 8px;">
3029
<strong style="color: #000000;">Name:</strong> {{ name }}
3130
</li>
32-
31+
3332
<li style="margin-bottom: 8px;">
3433
<strong style="color: #000000;">Email:</strong> {{ email }}
3534
</li>
36-
35+
3736
<li style="margin-bottom: 8px;">
3837
<strong style="color: #000000;">National Society:</strong> {{ national_society }}
3938
</li>

0 commit comments

Comments
 (0)