Add reply via email button
This commit is contained in:
parent
74930d1e9f
commit
09f17bdef1
4 changed files with 20 additions and 0 deletions
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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": {
|
||||
|
|
Reference in a new issue