From cd8048b477cc4f60355d61dc306a6bbe8560ff8f Mon Sep 17 00:00:00 2001 From: meeb Date: Sat, 28 Nov 2020 16:58:23 +1100 Subject: [PATCH] style tweaks, update source page --- app/common/static/styles/_colours.scss | 5 +++- app/common/static/styles/_helpers.scss | 4 ++++ app/common/static/styles/_template.scss | 7 +++++- app/common/templates/infobox.html | 11 +++++++++ app/common/templates/pagination.html | 12 ++++++---- app/sync/templates/sync/source-update.html | 28 ++++++++++++++++++++++ app/sync/templates/sync/source.html | 8 +++---- app/sync/templates/sync/sources.html | 13 ++++------ app/sync/urls.py | 22 +++++++++++++---- app/sync/views.py | 19 ++++++++++++--- 10 files changed, 103 insertions(+), 26 deletions(-) create mode 100644 app/common/templates/infobox.html create mode 100644 app/sync/templates/sync/source-update.html diff --git a/app/common/static/styles/_colours.scss b/app/common/static/styles/_colours.scss index 68d5d5b..e3cd44e 100644 --- a/app/common/static/styles/_colours.scss +++ b/app/common/static/styles/_colours.scss @@ -4,7 +4,7 @@ $colour-near-black: #011627; $colour-near-white: #fdfffc; $colour-light-blue: #2e8ac4; $colour-red: #e71d36; -$colour-orange: #f69e12; +$colour-orange: #ef9912; $background-colour: $colour-near-white; $text-colour: $colour-near-black; @@ -52,3 +52,6 @@ $pagination-border-hover-colour: $colour-light-blue; $pagination-current-background-colour: $colour-orange; $pagination-current-text-colour: $colour-near-white; $pagination-current-border-colour: $colour-orange; + +$infobox-background-colour: $colour-near-white; +$infobox-text-colour: $colour-near-black; diff --git a/app/common/static/styles/_helpers.scss b/app/common/static/styles/_helpers.scss index ee6a139..d1ef7b6 100644 --- a/app/common/static/styles/_helpers.scss +++ b/app/common/static/styles/_helpers.scss @@ -14,6 +14,10 @@ strong { margin-bottom: 20px !important; } +.padding-top { + padding-top: 20px; +} + .errors { background-color: $box-error-background-colour; border-radius: 2px; diff --git a/app/common/static/styles/_template.scss b/app/common/static/styles/_template.scss index f7ee5c9..3a1c46f 100644 --- a/app/common/static/styles/_template.scss +++ b/app/common/static/styles/_template.scss @@ -63,7 +63,7 @@ main { a { color: $main-link-colour; - text-decoration: underline; + text-decoration: none; &:hover { color: $main-link-hover-colour; } @@ -131,6 +131,11 @@ main { } } + .infobox { + background-color: $infobox-background-colour; + color: $infobox-text-colour; + } + } footer { diff --git a/app/common/templates/infobox.html b/app/common/templates/infobox.html new file mode 100644 index 0000000..fcb9b38 --- /dev/null +++ b/app/common/templates/infobox.html @@ -0,0 +1,11 @@ +{% if message %} +
+
+
+
+ {{ message }} +
+
+
+
+{% endif %} diff --git a/app/common/templates/pagination.html b/app/common/templates/pagination.html index 70a11c5..938d629 100644 --- a/app/common/templates/pagination.html +++ b/app/common/templates/pagination.html @@ -1,7 +1,11 @@ {% if paginator.num_pages > 1 %} - -
+ {% endblock %} diff --git a/app/sync/templates/sync/sources.html b/app/sync/templates/sync/sources.html index ae8e643..8593971 100644 --- a/app/sync/templates/sync/sources.html +++ b/app/sync/templates/sync/sources.html @@ -3,12 +3,13 @@ {% block headtitle %}Sources{% endblock %} {% block content %} +{% include 'infobox.html' with message=message %}
@@ -27,11 +28,5 @@
-{% if sources %} -
-
- {% include 'pagination.html' with pagination=sources.paginator %} -
-
-{% endif %} +{% include 'pagination.html' with pagination=sources.paginator %} {% endblock %} diff --git a/app/sync/urls.py b/app/sync/urls.py index 9bc9864..b6e48ec 100644 --- a/app/sync/urls.py +++ b/app/sync/urls.py @@ -1,6 +1,6 @@ from django.urls import path from .views import (DashboardView, SourcesView, ValidateSourceView, AddSourceView, - SourceView, MediaView, TasksView, LogsView) + SourceView, UpdateSourceView, MediaView, TasksView, LogsView) app_name = 'sync' @@ -8,19 +8,23 @@ app_name = 'sync' urlpatterns = [ + # Dashboard URLs + path('', DashboardView.as_view(), name='dashboard'), - + + # Source URLs + path('sources', SourcesView.as_view(), name='sources'), - path('source/validate/', + path('source-validate/', ValidateSourceView.as_view(), name='validate-source'), - path('source/add', + path('source-add', AddSourceView.as_view(), name='add-source'), @@ -28,14 +32,24 @@ urlpatterns = [ SourceView.as_view(), name='source'), + path('source-update/', + UpdateSourceView.as_view(), + name='update-source'), + + # Media URLs + path('media', MediaView.as_view(), name='media'), + # Task URLs + path('tasks', TasksView.as_view(), name='tasks'), + # Log URLs + path('logs', LogsView.as_view(), name='logs'), diff --git a/app/sync/views.py b/app/sync/views.py index 1338863..13267c4 100644 --- a/app/sync/views.py +++ b/app/sync/views.py @@ -1,7 +1,7 @@ from django.conf import settings from django.http import Http404 from django.views.generic import TemplateView, ListView, DetailView -from django.views.generic.edit import FormView, CreateView +from django.views.generic.edit import FormView, CreateView, UpdateView from django.urls import reverse_lazy from django.forms import ValidationError from django.utils.text import slugify @@ -32,7 +32,7 @@ class SourcesView(ListView): context_object_name = 'sources' paginate_by = settings.SOURCES_PER_PAGE messages = { - 'source-added': _('Your new source has been added'), + 'source-created': _('Your new source has been added'), 'source-deleted': _('Your selected source has been deleted.'), 'source-updated': _('Your selected source has been updated.'), } @@ -108,7 +108,7 @@ class ValidateSourceView(FormView): Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: { 'scheme': 'https', 'domain': 'www.youtube.com', - 'path_regex': '^\/playlist$', + 'path_regex': '^\/(playlist|watch)$', 'qs_args': ['list'], 'extract_key': ('qs_args', 'list'), 'example': 'https://www.youtube.com/playlist?list=PLAYLISTID' @@ -233,6 +233,19 @@ class SourceView(DetailView): model = Source +class UpdateSourceView(UpdateView): + + template_name = 'sync/source-update.html' + model = Source + fields = ('source_type', 'key', 'name', 'directory', 'delete_old_media', + 'days_to_keep', 'source_profile', 'prefer_60fps', 'prefer_hdr', + 'output_format', 'fallback') + + def get_success_url(self): + url = reverse_lazy('sync:sources') + return append_uri_params(url, {'message': 'source-updated'}) + + class MediaView(TemplateView): ''' A bare list of media added with their states.