From 133902ac65400d9a129d0cba3db3392b925d54e6 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Sat, 6 Jun 2020 00:24:37 +0200 Subject: [PATCH 1/1] Start to reorganize views a little. --- requirements.txt | 1 + src/archive/constants.py | 7 +- .../templates/archive/audiobook_list.html | 73 +++++++++++++++++++ src/archive/templates/archive/base.html | 9 +-- src/archive/templates/archive/book.html | 66 ++++++++++++++--- .../templates/archive/file_managed.html | 5 +- src/archive/templates/archive/file_new.html | 4 + .../templates/archive/file_unmanaged.html | 4 + src/archive/templates/archive/list.html | 6 +- src/archive/templates/archive/list_new.html | 4 + .../templates/archive/list_published.html | 22 ------ .../templates/archive/list_publishing.html | 3 + .../templates/archive/list_unmanaged.html | 4 + .../templates/archive/list_unpublished.html | 40 ---------- src/archive/templates/archive/status.html | 21 ++++++ .../templates/pagination/pagination.html | 53 ++++++++++++++ src/archive/templatetags/tags.py | 15 ++++ src/archive/urls.py | 7 +- src/archive/views.py | 29 ++------ src/audiobooks/settings.py | 3 +- 20 files changed, 259 insertions(+), 117 deletions(-) create mode 100644 src/archive/templates/archive/audiobook_list.html delete mode 100644 src/archive/templates/archive/list_published.html delete mode 100644 src/archive/templates/archive/list_unpublished.html create mode 100644 src/archive/templates/archive/status.html create mode 100644 src/archive/templates/pagination/pagination.html diff --git a/requirements.txt b/requirements.txt index fe95850..c355845 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ Django==3.0.6 django-cas-ng==4.1.1 django-bootstrap4==1.1.1 django-pglocks==1.0.4 +fnp-django-pagination==2.2.4 celery[redis]==4.4.2 diff --git a/src/archive/constants.py b/src/archive/constants.py index 3493e00..a5527ec 100644 --- a/src/archive/constants.py +++ b/src/archive/constants.py @@ -1,8 +1,9 @@ from django.utils.translation import gettext_lazy as _ + class status: - QUEUED = 1 - WAITING = 10 + WAITING = 1 + QUEUED = 10 ENCODING = 20 TAGGING = 30 CONVERTING_AUDIO = 40 @@ -14,8 +15,8 @@ class status: SETTING_THUMBNAIL = 110 choices = [ - (QUEUED, _('Queued')), (WAITING, _('Waiting')), + (QUEUED, _("Queued")), (ENCODING, _('Encoding')), (TAGGING, _('Tagging')), (CONVERTING_AUDIO, _('Converting audio')), diff --git a/src/archive/templates/archive/audiobook_list.html b/src/archive/templates/archive/audiobook_list.html new file mode 100644 index 0000000..1521b42 --- /dev/null +++ b/src/archive/templates/archive/audiobook_list.html @@ -0,0 +1,73 @@ +{% extends "archive/list.html" %} +{% load i18n %} +{% load pagination_tags %} + + +{% block menu-active-audiobooks %}active{% endblock %} + + +{% block file-list-title %} + {% trans "Audiobooks" %} +{% endblock %} + + +{% block file-list-info %} +{% endblock %} + +{% block file-list-wrapper %} + {% autopaginate object_list 50 %} + {{ block.super }} + {% paginate %} +{% endblock %} + + +{% block file-list %} + + + Slug + {% trans "Title" %} + {% trans "YouTube volume" %} + MP3 + Ogg + YouTube + + + {% for audiobook in object_list %} + + + {% if audiobook.slug %} + {{ audiobook.slug }} + {% endif %} + + {{ audiobook }} + + + {{ audiobook.youtube_volume }} + + + {% if audiobook.mp3_status %} + + MP3: + {{ audiobook.get_mp3_status_display }} + + {% endif %} + + + {% if audiobooks.ogg_status_display %} + + Ogg: + {{ audiobook.get_ogg_status_display }} + + {% endif %} + + + {% if audiobooks.youtube_status %} + + YT: + {{ audiobook.get_youtube_status_display }} + + {% endif %} + + + {% endfor %} +{% endblock %} diff --git a/src/archive/templates/archive/base.html b/src/archive/templates/archive/base.html index 9eeaf8c..f7e5ad7 100644 --- a/src/archive/templates/archive/base.html +++ b/src/archive/templates/archive/base.html @@ -3,11 +3,10 @@ {% block repo-zones-nav %}