From 6a21a9d0948079c2fc2d6b1ed9e61a303bcfdc0a Mon Sep 17 00:00:00 2001 From: bkfox Date: Wed, 22 Nov 2023 21:09:59 +0100 Subject: [PATCH] design --- aircox/filters.py | 2 +- aircox/models/episode.py | 10 +- aircox/models/page.py | 8 +- aircox/static/aircox/css/chunk-common.css | 123 +++++++---------- aircox/templates/aircox/base.html | 6 +- aircox/templates/aircox/home.html | 20 ++- aircox/templates/aircox/page_detail.html | 15 +- aircox/templates/aircox/page_list.html | 9 ++ aircox/templates/aircox/program_detail.html | 9 +- aircox/templates/aircox/widgets/header.html | 19 +-- aircox/templates/aircox/widgets/log.html | 5 +- aircox/views/home.py | 4 +- aircox/views/page.py | 13 +- assets/src/assets/styles.scss | 144 +++++++++----------- 14 files changed, 183 insertions(+), 204 deletions(-) diff --git a/aircox/filters.py b/aircox/filters.py index 3c541aa..2d584f1 100644 --- a/aircox/filters.py +++ b/aircox/filters.py @@ -10,7 +10,7 @@ class PageFilters(filters.FilterSet): class Meta: model = Page fields = { - "category__id": ["in"], + "category__id": ["in", "exact"], "pub_date": ["exact", "gte", "lte"], } diff --git a/aircox/models/episode.py b/aircox/models/episode.py index 5f8867b..1183e2c 100644 --- a/aircox/models/episode.py +++ b/aircox/models/episode.py @@ -17,7 +17,11 @@ class Episode(Page): @property def program(self): - return getattr(self.parent, "program", None) + return self.parent_subclass + + @program.setter + def program(self, value): + self.parent = value @cached_property def podcasts(self): @@ -40,10 +44,6 @@ class Episode(Page): podcasts[index]["page_title"] = self.title return podcasts - @program.setter - def program(self, value): - self.parent = value - class Meta: verbose_name = _("Episode") verbose_name_plural = _("Episodes") diff --git a/aircox/models/page.py b/aircox/models/page.py index 7e3572c..d541377 100644 --- a/aircox/models/page.py +++ b/aircox/models/page.py @@ -221,6 +221,12 @@ class Page(BasePage): objects = PageQuerySet.as_manager() + @cached_property + def parent_subclass(self): + if self.parent_id: + return Page.objects.get_subclass(id=self.parent_id) + return None + class Meta: verbose_name = _("Publication") verbose_name_plural = _("Publications") @@ -300,7 +306,7 @@ class Comment(Renderable, models.Model): return Page.objects.select_subclasses().filter(id=self.page_id).first() def get_absolute_url(self): - return self.parent.get_absolute_url() + return self.parent.get_absolute_url() + f"#comment-{self.pk}" class Meta: verbose_name = _("Comment") diff --git a/aircox/static/aircox/css/chunk-common.css b/aircox/static/aircox/css/chunk-common.css index ba6e6ee..5583f3e 100644 --- a/aircox/static/aircox/css/chunk-common.css +++ b/aircox/static/aircox/css/chunk-common.css @@ -9567,34 +9567,6 @@ a.navbar-item.is-active { font-weight: 100; } -/* -.page { - & > .cover { - float: right; - max-width: 45%; - } - - .header { - margin-bottom: 1.5em; - } - - .headline { - font-size: 1.4em; - padding: 0.2em 0em; - } - - p { padding: 0.4em 0em; } - hr { background-color: $grey-light; } - - .page-content { - h1 { font-size: $size-1; font-weight: bolder; margin-top:0.4em; margin-bottom:0.2em; } - h2 { font-size: $size-3; font-weight: bolder; margin-top:0.4em; margin-bottom:0.2em; } - h3 { font-size: $size-4; font-weight: bolder; margin-top:0.4em; margin-bottom:0.2em; } - h4 { font-size: $size-5; font-weight: bolder; margin-top:0.4em; margin-bottom:0.2em; } - h5 { font-size: $size-6; font-weight: bolder; margin-top:0.4em; margin-bottom:0.2em; } - h6 { font-size: $size-6; margin-top:0.4em; margin-bottom:0.2em; } - } -}*/ .player { z-index: 10000; box-shadow: 0em 1.5em 2.5em rgba(0, 0, 0, 0.6); @@ -9649,12 +9621,22 @@ a.navbar-item.is-active { margin: 0em; } -.media .subtitle { - margin-bottom: 0.4em; -} -.media .media-content .headline { - font-size: 1em; - font-weight: 400; +:root { + --text-color: black; + --highlight-color: rgba(255, 255, 0, 1); + --highlight-color-alpha: rgba(255, 255, 0, 0.6); + --highlight-color-2: rgb(0, 0, 254); + --highlight-color-2-alpha: rgb(0, 0, 254, 0.6); + --header-height: 30em; + --heading-height: 30em; + --heading-title-bg-color: rgba(255, 255, 0, 1); + --heading-bg-color: var(--highlight-color); + --heading-bg-highlight-color: var(--highlight-color-2); + --preview-media-height: 10em; + --preview-media-cover-size: 10em; + --preview-cover-size: 24em; + --preview-cover-small-size: 10em; + --heading-font-family: default; } body { @@ -9696,24 +9678,6 @@ aside .media .subtitle { display: inline-block; } -:root { - --text-color: black; - --highlight-color: rgba(255, 255, 0, 1); - --highlight-color-alpha: rgba(255, 255, 0, 0.6); - --highlight-color-2: rgb(0, 0, 254); - --highlight-color-2-alpha: rgb(0, 0, 254, 0.6); - --header-height: 30em; - --heading-height: 30em; - --heading-title-bg-color: rgba(255, 255, 0, 1); - --heading-bg-color: var(--highlight-color); - --heading-bg-highlight-color: var(--highlight-color-2); - --preview-media-height: 10em; - --preview-media-cover-size: 10em; - --preview-cover-size: 24em; - --preview-cover-small-size: 10em; - --heading-font-family: default; -} - h1, h2, h3, h4, h5, h6, .heading, .title, .subtitle { font-family: var(--heading-font-family); } @@ -9726,6 +9690,21 @@ h1, h2, h3, h4, h5, h6, .heading, .title, .subtitle { color: var(--highlight-color-2); text-decoration: none; } +.page .content { + font-size: 2em; +} +.page section.container { + padding-top: 2em; +} +.page section.container > .title { + margin-top: unset; + padding-top: unset !important; + margin-bottom: 1.2em; +} +.page section.container:not(:first-child) { + margin-top: 2em; + border-top: 1px solid black; +} .d-inline { display: inline; @@ -9813,24 +9792,20 @@ h1, h2, h3, h4, h5, h6, .heading, .title, .subtitle { margin-top: 0.8em; } -.content { - font-size: 1.4em; -} - -.heading, .headings-container > * { +.heading { display: inline-block; } -.heading:not(:empty), .headings-container > *:not(:empty) { +.heading:not(:empty) { background-color: var(--heading-bg-color); padding: 0.4em; margin-top: 0em !important; vertical-align: top; } -.heading:not(:empty).highlight, .headings-container > *:not(:empty).highlight { +.heading:not(:empty).highlight { background-color: var(--heading-bg-highlight-color); color: var(--highlight-color); } -.heading.title, .headings-container > *.title { +.heading.title { background-color: var(--heading-title-bg-color); } @@ -9862,15 +9837,15 @@ h1, h2, h3, h4, h5, h6, .heading, .title, .subtitle { background-color: var(--highlight-color-2); color: var(--highlight-color); } -.nav.primary .navbar-brand { +.nav.primary .nav-brand { display: inline-block; margin-right: 0.8em; padding: 0.8em; } -.nav.primary .navbar-brand img { +.nav.primary .nav-brand img { width: 14em !important; } -.nav.primary .navbar-menu { +.nav.primary .nav-menu { display: flex; flex-grow: 1; } @@ -9892,10 +9867,15 @@ nav li a, nav li .button { font-size: 1.4em; } +.page-content { + margin-top: 2em; + margin-bottom: 2em; +} + .preview { position: relative; background-size: cover; - margin-bottom: 0.8em; + margin-bottom: 1.2em !important; } .preview.preview-card:not(.wide) { max-width: 30em; @@ -9904,7 +9884,8 @@ nav li a, nav li .button { width: 100%; } .preview.columns, .preview .headings.columns { - margin: 0em; + margin-left: 0em; + margin-right: 0em; } .preview.columns .column, .preview .headings.columns .column { padding: 0em; @@ -9945,7 +9926,7 @@ nav li a, nav li .button { } .list-item .headings { padding-top: 0em; - margin-bottom: 0.8em !important; + margin-bottom: 1.2em !important; background-color: var(--heading-bg-color); } .list-item .subtitle { @@ -9954,16 +9935,16 @@ nav li a, nav li .button { .list-item .media-content { display: flex; flex-direction: column; -} -.list-item:not(.no-cover) .list-item .media-content { - height: var(--preview-cover-small-size); + min-height: var(--preview-cover-small-size); } .list-item .media-content .content { flex-grow: 1; + margin-bottom: auto; } .list-item .media-content .actions { - flex-grow: 0; + flex-grow: unset; text-align: right; + margin-top: auto; } .preview-wide { @@ -9975,7 +9956,7 @@ nav li a, nav li .button { .preview-wide .headings { width: var(--preview-cover-size); flex-grow: 0; - margin-right: 0.8em; + margin-right: 1.2em; } .preview-wide .content { font-size: 2em; diff --git a/aircox/templates/aircox/base.html b/aircox/templates/aircox/base.html index 76def3c..a1c21d8 100644 --- a/aircox/templates/aircox/base.html +++ b/aircox/templates/aircox/base.html @@ -52,10 +52,10 @@ Usefull context: {% block nav %}