Add link to tags list to tags on content details

This commit is contained in:
Jake Howard 2022-09-23 08:45:17 +01:00
parent 4b10ce6f6f
commit bee03a8e64
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 17 additions and 2 deletions

View file

@ -23,6 +23,14 @@ section.content {
margin-right: $icon-text-spacing * 3; margin-right: $icon-text-spacing * 3;
align-items: center; align-items: center;
.icon a {
color: inherit;
&:hover {
color: $link;
}
}
span:not(.icon) + span { span:not(.icon) + span {
margin-left: $icon-text-spacing; margin-left: $icon-text-spacing;
} }

View file

@ -1,4 +1,4 @@
from typing import Any, Type from typing import Any, Optional, Type
from django.db import models from django.db import models
from django.db.models.functions import TruncMonth 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.models import BaseContentPage, BaseListingPage
from website.common.utils import TocEntry, prefetch_for_listing from website.common.utils import TocEntry, prefetch_for_listing
from website.common.views import ContentPageFeed from website.common.views import ContentPageFeed
from website.contrib.singleton_page.utils import SingletonPageCache
class BlogPostListPage(BaseListingPage): class BlogPostListPage(BaseListingPage):
@ -66,6 +67,10 @@ class BlogPostPage(BaseContentPage):
AutocompletePanel("tags"), AutocompletePanel("tags"),
] ]
@cached_property
def tag_list_page_url(self) -> Optional[str]:
return SingletonPageCache.get_url(BlogPostTagListPage)
class BlogPostTagListPage(BaseListingPage): class BlogPostTagListPage(BaseListingPage):
max_count = 1 max_count = 1

View file

@ -23,7 +23,9 @@
{% if page.tags.all %} {% if page.tags.all %}
<div class="icon-text"> <div class="icon-text">
<span class="icon"> <span class="icon">
<a href="{{ page.tag_list_page_url }}" title="View all tags">
<i class="fas fa-lg fa-tags"></i> <i class="fas fa-lg fa-tags"></i>
</a>
</span> </span>
{% for tag in page.tags.all %} {% for tag in page.tags.all %}
<span><a title="{{ tag.name }}" href="{% pageurl tag %}">#{{ tag.slug }}</a></span> <span><a title="{{ tag.name }}" href="{% pageurl tag %}">#{{ tag.slug }}</a></span>