From 8d6707db953d2a844b636ad295c9b0c991e557eb Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Mon, 9 Sep 2024 16:58:33 -0400 Subject: [PATCH] [templates] Clean up redundent templates and fix main menu --- vrobbler/apps/boardgames/views.py | 7 +- vrobbler/apps/books/urls.py | 6 +- vrobbler/apps/scrobbles/views.py | 2 +- vrobbler/apps/videogames/urls.py | 8 +- vrobbler/templates/_scrobblable_list.html | 36 +++++++++ vrobbler/templates/base.html | 24 ++++++ .../templates/boardgames/boardgame_list.html | 22 +----- vrobbler/templates/books/book_list.html | 23 ++++++ vrobbler/templates/moods/mood_list.html | 21 +----- vrobbler/templates/trails/trail_detail.html | 73 +++++++++++++++++++ vrobbler/templates/trails/trail_list.html | 23 ++++++ .../templates/videogames/videogame_list.html | 31 ++++---- 12 files changed, 206 insertions(+), 70 deletions(-) create mode 100644 vrobbler/templates/_scrobblable_list.html create mode 100644 vrobbler/templates/books/book_list.html create mode 100644 vrobbler/templates/trails/trail_detail.html create mode 100644 vrobbler/templates/trails/trail_list.html diff --git a/vrobbler/apps/boardgames/views.py b/vrobbler/apps/boardgames/views.py index ab02860..c2ffce2 100644 --- a/vrobbler/apps/boardgames/views.py +++ b/vrobbler/apps/boardgames/views.py @@ -1,15 +1,14 @@ from django.views import generic from boardgames.models import BoardGame, BoardGamePublisher +from scrobbles.views import ScrobbleableListView, ScrobbleableDetailView -class BoardGameListView(generic.ListView): +class BoardGameListView(ScrobbleableListView): model = BoardGame - paginate_by = 20 -class BoardGameDetailView(generic.DetailView): +class BoardGameDetailView(ScrobbleableDetailView): model = BoardGame - slug_field = "uuid" class BoardGamePublisherDetailView(generic.DetailView): diff --git a/vrobbler/apps/books/urls.py b/vrobbler/apps/books/urls.py index 6638eea..9f7fba9 100644 --- a/vrobbler/apps/books/urls.py +++ b/vrobbler/apps/books/urls.py @@ -5,14 +5,14 @@ app_name = "books" urlpatterns = [ - path("book/", views.BookListView.as_view(), name="book_list"), + path("books/", views.BookListView.as_view(), name="book_list"), path( - "book//", + "books//", views.BookDetailView.as_view(), name="book_detail", ), path( - "author//", + "authors//", views.AuthorDetailView.as_view(), name="author_detail", ), diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index 9d02091..2ef1a4b 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -60,7 +60,7 @@ logger = logging.getLogger(__name__) class ScrobbleableListView(ListView): model = None - paginate_by = 20 + paginate_by = 200 def get_queryset(self): queryset = super().get_queryset() diff --git a/vrobbler/apps/videogames/urls.py b/vrobbler/apps/videogames/urls.py index d1ad09e..89a4f51 100644 --- a/vrobbler/apps/videogames/urls.py +++ b/vrobbler/apps/videogames/urls.py @@ -6,15 +6,17 @@ app_name = "videogames" urlpatterns = [ path( - "video-game/", views.VideoGameListView.as_view(), name="videogame_list" + "video-games/", + views.VideoGameListView.as_view(), + name="videogame_list", ), path( - "video-game//", + "video-games//", views.VideoGameDetailView.as_view(), name="videogame_detail", ), path( - "video-game-platform//", + "video-game-platforms//", views.VideoGamePlatformDetailView.as_view(), name="platform_detail", ), diff --git a/vrobbler/templates/_scrobblable_list.html b/vrobbler/templates/_scrobblable_list.html new file mode 100644 index 0000000..a5c88c0 --- /dev/null +++ b/vrobbler/templates/_scrobblable_list.html @@ -0,0 +1,36 @@ +{% load urlreplace %} + + + + + + + + + + + {% for obj in object_list %} + + + {% if request.user.is_authenticated %} + + + {% endif %} + + {% endfor %} + +
TitleScrobblesStart
{{obj}}{{obj.scrobble_count}}Scrobble
+ +

+ + {% if page_obj.has_previous %} + prev + {% endif %} + + Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }} + + {% if page_obj.has_next %} + next + {% endif %} + +

diff --git a/vrobbler/templates/base.html b/vrobbler/templates/base.html index b3b785a..7de7ae5 100644 --- a/vrobbler/templates/base.html +++ b/vrobbler/templates/base.html @@ -234,6 +234,30 @@ Long plays + + + +