Browse Source

Add reply via email button

master
Gabriel Augendre 5 months ago
parent
commit
09f17bdef1
  1. 4
      src/articles/models.py
  2. 10
      src/articles/static/public.css
  3. 5
      src/articles/templates/articles/article_detail.html
  4. 1
      src/blog/settings.py

4
src/articles/models.py

@ -81,6 +81,10 @@ class Article(models.Model):
def get_absolute_url(self):
return reverse("article-detail", kwargs={"slug": self.slug})
def get_mailto_url(self):
email = settings.BLOG["email"]
return f"mailto:{email}?subject={self.title}"
def get_abstract(self):
html = self.get_formatted_content
return html.split("<!--more-->")[0]

10
src/articles/static/public.css

@ -27,3 +27,13 @@ nav a:not(:first-child):before, a.tag:not(:first-of-type):before {
text-decoration: none;
display: inline-block;
}
#reply {
text-align: center;
margin-top: 2em;
}
#reply a button {
font-size: 1.2rem;
padding: 8px 16px;
}

5
src/articles/templates/articles/article_detail.html

@ -15,6 +15,11 @@
{{ article.get_formatted_content|safe }}
</div>
</article>
<section id="reply">
<a href="{{ article.get_mailto_url }}&body={{ request.build_absolute_uri }}">
<button> Reply via email</button>
</a>
</section>
{% if article.get_related_articles %}
<section>
<hr>

1
src/blog/settings.py

@ -216,6 +216,7 @@ AUTH_USER_MODEL = "articles.User"
BLOG = {
"title": "Gab's Notes",
"author": "Gabriel Augendre",
"email": "ga-notes@augendre.info",
"description": "My take on tech-related subjects (but not only).",
"base_url": env("BLOG_BASE_URL"),
"repo": {

Loading…
Cancel
Save