Skip to content

Commit

Permalink
email templates
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer committed Nov 20, 2024
1 parent 626d7d8 commit 36ca76f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{# djlint:off #}
{% for values in saved_search.get_filters_dict.values %}{% if not forloop.first %}, {% endif %}{{ values|join:", " }}{% endfor %}
{# djlint:on #}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ <h1 id="saved-search-modal-label" class="modal-title fs-5">{% trans 'Search aler
hx-target="#saved-search-button"
hx-post="{% url 'search:saved_search_update' saved_search.pk %}">
<div class="mb-3">{{ saved_search.q }}</div>
<div class="mb-3">
{# djlint:off #}
{% for values in saved_search.get_filters_dict.values %}{% if not forloop.first %},&nbsp;{% endif %}{{ values|join:", " }}{% endfor %}
{# djlint:on #}
</div>
<div class="mb-3">{% include 'peachjam_search/_saved_search_filters.html' %}</div>
<div>
<label class="form-label" for="{{ form.note.id_for_label }}">{{ form.note.label }}</label>
<textarea class="form-control"
Expand Down
27 changes: 16 additions & 11 deletions peachjam_search/templates/peachjam_search/emails/search_alert.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
{% load i18n %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Search Alert</title>
<title>{% trans "Search Alert" %}</title>
</head>
<body>
<p>Hi {{ saved_search.user }}</p>
<p>We have found new documents that match your search for:</p>
<p>{{ saved_search.user }},</p>
<p>{% trans "We have found new documents that match your search alert:" %}</p>
<p>
<strong>{{ saved_search.q }}</strong>
<strong><a href="{{ site.domain }}{{ saved_search.get_absolute_url }}">{{ saved_search.q }}</a></strong>
</p>
<p>{% include 'peachjam_search/_saved_search_filters.html' %}</p>
<ul>
{% for doc in hits %}
<li>
<a href="{{ site.domain }}{{ doc.expression_frbr_uri }}">{{ doc.title }}</a>
</li>
{% endfor %}
</ul>
<p>
<a href="{{ site.domain }}{% url "search:saved_search_list" %}">{% trans "Manage your search alerts" %}</a>
</p>
<p>Here are the new documents:</p>
{% for doc in hits %}
<h3>
<a href="{{ site.domain }}{{ doc.expression_frbr_uri }}">{{ doc.title }}</a>
</h3>
{% endfor %}
<p>Best regards.</p>
</body>
</html>
19 changes: 11 additions & 8 deletions peachjam_search/templates/peachjam_search/emails/search_alert.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
Search Alert
Hi {{ saved_search.user }}
We have found new documents that match your search for:
{{ saved_search.user }},

We have found new documents that match your search alert:

{{ saved_search.q }}
Here are the new documents:

{{ site.domain }}{{ saved_search.get_absolute_url }}

{% for doc in hits %}
TITLE: {{ doc.title }}
URL: {{ site.domain }}{{ doc.expression_frbr_uri }}
========================
Title: {{ doc.title }}
{{ site.domain }}{{ doc.expression_frbr_uri }}

{% endfor %}

Best regards.

Manage your search alerts: {{ site.domain }}{% url "search:saved_search_list" %}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ <h2>{% trans 'Search alerts' %}</h2>
<br/>
<span class="text-muted">{{ search.note }}</span>
</div>
<div class="col-md-6">
{# djlint:off #}
{% for values in search.get_filters_dict.values %}{% if not forloop.first %},&nbsp;{% endif %}{{ values|join:", " }}{% endfor %}
{# djlint:on #}
</div>
<div class="col-md-6">{% include 'peachjam_search/_saved_search_filters.html' with saved_search=search %}</div>
</div>
<div>
<form action="{% url 'search:saved_search_delete' search.pk %}?next={{ request.get_full_path }}"
Expand Down

0 comments on commit 36ca76f

Please sign in to comment.