From bee03a8e64ffea618065e0f39ca92714b0ca267c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 23 Sep 2022 08:45:17 +0100 Subject: [PATCH] Add link to tags list to tags on content details --- static/src/scss/_content.scss | 8 ++++++++ website/blog/models.py | 7 ++++++- website/common/templates/common/content-details.html | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/static/src/scss/_content.scss b/static/src/scss/_content.scss index eb47936..4a557d9 100644 --- a/static/src/scss/_content.scss +++ b/static/src/scss/_content.scss @@ -23,6 +23,14 @@ section.content { margin-right: $icon-text-spacing * 3; align-items: center; + .icon a { + color: inherit; + + &:hover { + color: $link; + } + } + span:not(.icon) + span { margin-left: $icon-text-spacing; } diff --git a/website/blog/models.py b/website/blog/models.py index 9b41660..419797e 100644 --- a/website/blog/models.py +++ b/website/blog/models.py @@ -1,4 +1,4 @@ -from typing import Any, Type +from typing import Any, Optional, Type from django.db import models from django.db.models.functions import TruncMonth @@ -11,6 +11,7 @@ from wagtailautocomplete.edit_handlers import AutocompletePanel from website.common.models import BaseContentPage, BaseListingPage from website.common.utils import TocEntry, prefetch_for_listing from website.common.views import ContentPageFeed +from website.contrib.singleton_page.utils import SingletonPageCache class BlogPostListPage(BaseListingPage): @@ -66,6 +67,10 @@ class BlogPostPage(BaseContentPage): AutocompletePanel("tags"), ] + @cached_property + def tag_list_page_url(self) -> Optional[str]: + return SingletonPageCache.get_url(BlogPostTagListPage) + class BlogPostTagListPage(BaseListingPage): max_count = 1 diff --git a/website/common/templates/common/content-details.html b/website/common/templates/common/content-details.html index 94f0e88..60cac00 100644 --- a/website/common/templates/common/content-details.html +++ b/website/common/templates/common/content-details.html @@ -23,7 +23,9 @@ {% if page.tags.all %}
- + + + {% for tag in page.tags.all %} #{{ tag.slug }}