minor ui tweak

This commit is contained in:
Your Name 2024-06-03 23:39:20 -04:00 committed by Henri Dickson
parent feef968fb9
commit df315c9e67
8 changed files with 21 additions and 15 deletions

View file

@ -58,8 +58,9 @@ class IdType(models.TextChoices):
ISSN = "issn", _("ISSN") # type:ignore[reportCallIssue] ISSN = "issn", _("ISSN") # type:ignore[reportCallIssue]
CUBN = "cubn", _("CUBN") # type:ignore[reportCallIssue] CUBN = "cubn", _("CUBN") # type:ignore[reportCallIssue]
ISRC = "isrc", _("ISRC") # only for songs # type:ignore[reportCallIssue] ISRC = "isrc", _("ISRC") # only for songs # type:ignore[reportCallIssue]
GTIN = "gtin", _( GTIN = (
"GTIN UPC EAN" "gtin",
_("GTIN UPC EAN"),
) # GTIN-13, ISBN is separate # type:ignore[reportCallIssue] ) # GTIN-13, ISBN is separate # type:ignore[reportCallIssue]
RSS = "rss", _("RSS Feed URL") # type:ignore[reportCallIssue] RSS = "rss", _("RSS Feed URL") # type:ignore[reportCallIssue]
IMDB = "imdb", _("IMDb") # type:ignore[reportCallIssue] IMDB = "imdb", _("IMDb") # type:ignore[reportCallIssue]

View file

@ -140,9 +140,18 @@ class DiscoverGenerator(BaseJob):
.values_list("pk", flat=True)[:40] .values_list("pk", flat=True)[:40]
) )
tags = TagManager.popular_tags(days=14)[:40] tags = TagManager.popular_tags(days=14)[:40]
post_ids = Takahe.get_popular_posts( post_ids = set(
30, settings.MIN_MARKS_FOR_DISCOVER list(
).values_list("pk", flat=True)[:20] Takahe.get_popular_posts(
7, settings.MIN_MARKS_FOR_DISCOVER
).values_list("pk", flat=True)[:10]
)
+ list(
Takahe.get_popular_posts(
28, settings.MIN_MARKS_FOR_DISCOVER
).values_list("pk", flat=True)[:20]
)
)
cache.set(cache_key, gallery_list, timeout=None) cache.set(cache_key, gallery_list, timeout=None)
cache.set("trends_links", trends, timeout=None) cache.set("trends_links", trends, timeout=None)
cache.set("featured_collections", collection_ids, timeout=None) cache.set("featured_collections", collection_ids, timeout=None)

View file

@ -264,9 +264,7 @@ def discover(request):
identity = request.user.identity identity = request.user.identity
announcements = [] announcements = []
post_ids = cache.get("popular_posts", []) post_ids = cache.get("popular_posts", [])
i = rot * len(post_ids) // 10 popular_posts = Takahe.get_posts(post_ids).order_by("-published")
post_ids = post_ids[i:] + post_ids[:i]
popular_posts = Takahe.get_posts(post_ids)
else: else:
identity = None identity = None
layout = [] layout = []

View file

@ -148,10 +148,6 @@ body {
} }
.nav-links li.small-only { .nav-links li.small-only {
>.search-btn {
font-size: 125%;
margin-top: 0.2em;
}
a { a {
color: var(--pico-secondary); color: var(--pico-secondary);
} }

View file

@ -50,7 +50,7 @@
</li> </li>
</ul> </ul>
<ul class="nav-links"> <ul class="nav-links">
<li class="small-only"> <li class="small-only" style="font-size: 125%; margin-top: 0.2em;">
<a class="nav-link-search" <a class="nav-link-search"
_="on click toggle .unhide on .nav-search then call #q.focus()" _="on click toggle .unhide on .nav-search then call #q.focus()"
href="#"><i class="fa-solid fa-magnifying-glass"></i></a> href="#"><i class="fa-solid fa-magnifying-glass"></i></a>

View file

@ -24,7 +24,8 @@ class UserOwnedObjectMixin:
visibility: int visibility: int
def is_visible_to( def is_visible_to(
self: "Piece", viewing_user: "User" # noqa # type: ignore self: "Piece", # type: ignore
viewing_user: "User",
) -> bool: ) -> bool:
owner = self.owner owner = self.owner
if not owner or not owner.is_active: if not owner or not owner.is_active:

View file

@ -12,7 +12,7 @@
</div> </div>
<div style="flex-grow:1;"> <div style="flex-grow:1;">
<span class="action"> <span class="action">
<span class="timestamp">{{ post.created|naturaldelta }}</span> <span class="timestamp">{{ post.published|naturaldelta }}</span>
{% include "action_reply_post.html" %} {% include "action_reply_post.html" %}
{% include "action_like_post.html" %} {% include "action_like_post.html" %}
{% include "action_boost_post.html" %} {% include "action_boost_post.html" %}

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
"""Django's command-line utility for administrative tasks.""" """Django's command-line utility for administrative tasks."""
import os import os
import sys import sys