Add "View all" button for similar content
This commit is contained in:
parent
f3ee847b28
commit
cbd1eb027b
4 changed files with 14 additions and 2 deletions
|
@ -4,10 +4,14 @@ section#similar-content {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
|
|
||||||
h2 {
|
.subtitle {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.view-all {
|
||||||
|
margin: $block-spacing 0;
|
||||||
|
}
|
||||||
|
|
||||||
.media {
|
.media {
|
||||||
@include desktop {
|
@include desktop {
|
||||||
transform: scale(85%);
|
transform: scale(85%);
|
||||||
|
|
|
@ -68,6 +68,10 @@ class BlogPostPage(BaseContentPage):
|
||||||
def tag_list_page_url(self) -> Optional[str]:
|
def tag_list_page_url(self) -> Optional[str]:
|
||||||
return SingletonPageCache.get_url(BlogPostTagListPage)
|
return SingletonPageCache.get_url(BlogPostTagListPage)
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def blog_post_list_page_url(self) -> Optional[str]:
|
||||||
|
return SingletonPageCache.get_url(BlogPostListPage)
|
||||||
|
|
||||||
def get_similar_posts(self) -> models.QuerySet:
|
def get_similar_posts(self) -> models.QuerySet:
|
||||||
try:
|
try:
|
||||||
listing_pages = BlogPostListPage.objects.get().get_listing_pages()
|
listing_pages = BlogPostListPage.objects.get().get_listing_pages()
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
{% include "common/listing-item.html" %}
|
{% include "common/listing-item.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<p class="subtitle view-all">
|
||||||
|
<a href="{{ page.blog_post_list_page_url }}">View all →</a>
|
||||||
|
</p>
|
||||||
</section>
|
</section>
|
||||||
{% endcache %}
|
{% endcache %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class BlogPostPageTestCase(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
def test_queries(self) -> None:
|
def test_queries(self) -> None:
|
||||||
with self.assertNumQueries(45):
|
with self.assertNumQueries(47):
|
||||||
self.client.get(self.page.url)
|
self.client.get(self.page.url)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue