From 6304dc5cc126cc2b6c5ef9d780d738c8eea94550 Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Mon, 30 Sep 2024 13:45:38 -0400 Subject: [PATCH 01/16] Update search results UI - change "label" to "title" in sort - only show date added if sorting by it - show collections in each result --- apps/readux/forms.py | 4 +- apps/templates/search_results.html | 13 +- apps/templates/search_results_backup.html | 152 --------------------- apps/templates/snippets/volume_result.html | 52 +++---- 4 files changed, 27 insertions(+), 194 deletions(-) delete mode 100644 apps/templates/search_results_backup.html diff --git a/apps/readux/forms.py b/apps/readux/forms.py index 74bdf68f..1179f59d 100644 --- a/apps/readux/forms.py +++ b/apps/readux/forms.py @@ -111,8 +111,8 @@ class ManifestSearchForm(forms.Form): ("created_at", "Date added (oldest first)"), ("-date_sort_descending", "Date published (newest first)"), ("date_sort_ascending", "Date published (oldest first)"), - ("label_alphabetical", "Label (A-Z)"), - ("-label_alphabetical", "Label (Z-A)"), + ("label_alphabetical", "Title (A-Z)"), + ("-label_alphabetical", "Title (Z-A)"), ("_score", "Relevance"), ), widget=forms.Select( diff --git a/apps/templates/search_results.html b/apps/templates/search_results.html index f699b007..489b58b8 100644 --- a/apps/templates/search_results.html +++ b/apps/templates/search_results.html @@ -48,8 +48,6 @@ - - {% include '_home/_nav.html' %}
@@ -76,10 +74,8 @@
-
{{ form.sort }} -
@@ -101,28 +96,28 @@
- +
{{ form.collection }}
- +
{{ form.author }}
- +
{{ form.language }}
- +
diff --git a/apps/templates/search_results_backup.html b/apps/templates/search_results_backup.html deleted file mode 100644 index dde8143f..00000000 --- a/apps/templates/search_results_backup.html +++ /dev/null @@ -1,152 +0,0 @@ -{% extends "base.html" %} -{% load wagtailcore_tags static readux_extras %} - -{% block extra_head %} - - - - - -{% endblock %} -{% block extra_javascript %} - - - - -{% endblock %} -{% block extra_css %} - - -{% endblock %} -{% block body_class %}template-homepage{% endblock %} - -{% block content %} -
- -
-
- {{ form.scope }} -
-
- - -
-
- -
-
- {{ form.sort }} - -
-
- -
-
- -
-
- -
- {{ form.collection }} -
- -
-
- -
- {{ form.author }} -
- -
-
- -
- {{ form.language }} -
- -
-
- - -
-
- -
- - {% for key in CUSTOM_METADATA_KEYS %} -
- {% with form|dict_item:key as field %} -
- -
- {{ field }} - {% endwith %} -
- {% endfor %} - -
- - -
-
- -
-
-
{{ volumes.count }} result{{ volumes.count|pluralize }}
-
{% include "snippets/pagination.html" %}
-
-
    - {% for volume in volumes %} - {% include "snippets/volume_result.html" %} - {% endfor %} -
-
- {% include "snippets/pagination.html" %} -
-
- -
-
-{% endblock content %} \ No newline at end of file diff --git a/apps/templates/snippets/volume_result.html b/apps/templates/snippets/volume_result.html index 136e48bd..e5ae0fb7 100644 --- a/apps/templates/snippets/volume_result.html +++ b/apps/templates/snippets/volume_result.html @@ -1,10 +1,7 @@ {% load readux_extras %}
  • -

    - +

    {% if volume.pid %} {% else %} @@ -25,31 +22,15 @@ {{ fragment|safe }} {% endfor %} {% else %} - {{ volume.label }} + {{ volume.label|default:"[no title]" }} {% endif %} {% endif %}

    -
    -
    - {% if volume.summary %} -
    Summary
    -
    - {% if 'highlight' in volume.meta and volume.meta.highlight.summary %} - {% for fragment in volume.meta.highlight.summary %} - {{ fragment|safe }} - {% endfor %} - {% else %} - {{ volume.summary|safe }} - {% endif %} -
    - {% endif %} -
    +
    {% if volume.authors and "[no author]" not in volume.authors %} -
    Author{{volume.authors|pluralize}}
    +
    Author{{volume.authors|pluralize}}
      @@ -88,13 +69,8 @@
      Published
      {{volume.published_date}}
      {% endif %} - - {% if volume.created_at %} -
      Added
      -
      {{volume.created_at}}
      - {% endif %} {% if volume.languages and "[no language]" not in volume.languages %} -
      Language{{volume.languages|pluralize}}
      +
      Language{{volume.languages|pluralize}}
        {% for lang in volume.languages %} @@ -103,6 +79,20 @@
      {% endif %} - + {% if volume.collections %} +
      Collection{{volume.collections|pluralize}}
      +
      +
        + {% for collection in volume.collections %} +
      • {{ collection.label }}
      • + {% endfor %} +
      +
      + {% endif %} + {# only show date added if it is the sort field #} + {% if "created_at" in request.GET.sort and volume.created_at %} +
      Added
      +
      {{volume.created_at}}
      + {% endif %}
  • From 1b28a7ad269ec19575d58d5004e6c6ac64affc4f Mon Sep 17 00:00:00 2001 From: Y Date: Thu, 3 Oct 2024 23:20:33 -0400 Subject: [PATCH 02/16] restructure footer and its relation to the base.html extract footer from individual template and consolidate them in the base.html. push the footer to the bottom of the screen when the page's height is not tall enough to fill the entire viewport. --- apps/static/css/readux2/main.scss | 17 +++++++++++++++++ apps/templates/base.html | 3 ++- apps/templates/cms/collections_page.html | 2 -- apps/templates/cms/content_page.html | 2 -- apps/templates/cms/volumes_page.html | 2 -- apps/templates/collection.html | 1 - apps/templates/pages/home.html | 1 - apps/templates/search_results.html | 2 -- 8 files changed, 19 insertions(+), 11 deletions(-) diff --git a/apps/static/css/readux2/main.scss b/apps/static/css/readux2/main.scss index a6d5e18e..ed005496 100644 --- a/apps/static/css/readux2/main.scss +++ b/apps/static/css/readux2/main.scss @@ -1,4 +1,21 @@ /* base.html */ +html, body { + height: 100%; + margin: 0; + display: flex; + flex-direction: column; +} + +#v-readux { + flex-grow: 1; + display: flex; + flex-direction: column; +} + +main { + flex-grow: 1; +} + .landing { margin: 0; padding: 0; diff --git a/apps/templates/base.html b/apps/templates/base.html index 8d4a9ae2..92a3b3f0 100644 --- a/apps/templates/base.html +++ b/apps/templates/base.html @@ -95,7 +95,7 @@ Jump to main content {# Primary container; host for Vue application #} -
    +
    {% comment %} TODO: Remove existing nav and replace with the following partial. It seems it may be added elsewhere; vue? needs investigation. @@ -124,6 +124,7 @@ {% block viewer %}{% endblock viewer %} + {% include '_home/_footer.html' %}
    diff --git a/apps/templates/cms/collections_page.html b/apps/templates/cms/collections_page.html index 4c6c5b7c..6019d677 100644 --- a/apps/templates/cms/collections_page.html +++ b/apps/templates/cms/collections_page.html @@ -67,8 +67,6 @@

    {{ collection.label|default:"[no title]"|truncatechars:200 }}

    -{% include '_home/_footer.html' %} - {% include_block page.body %} + +{% endblock %} {% block inner %} -

    {% trans "Sign Up" %}

    + +{% include '_home/_nav.html' %} -

    {% blocktrans %}Already have an account? Then please sign in.{% endblocktrans %}

    +
    - + + + +

    {% trans "Sign Up" %}

    -{% endblock %} +

    {% blocktrans %}Already have an account? Then please sign in.{% endblocktrans %}

    + + + + +
    +{% endblock %} \ No newline at end of file From 7de2a6dd51564936849015d3f9830f01b71e45d4 Mon Sep 17 00:00:00 2001 From: Y Date: Sat, 5 Oct 2024 17:17:47 -0400 Subject: [PATCH 05/16] improve the "full description" button for collections --- apps/static/css/readux2/main.scss | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/static/css/readux2/main.scss b/apps/static/css/readux2/main.scss index ed005496..d586b0dc 100644 --- a/apps/static/css/readux2/main.scss +++ b/apps/static/css/readux2/main.scss @@ -613,4 +613,15 @@ iframe { .brand-tagline { font-size: small; color: white; +} + + +.description-button { + transition: ease 0.1s; + &:hover { + background-color: darken(#E60000, 10%); + } + &:active { + background-color: darken(#E60000, 25%); + } } \ No newline at end of file From 5b2db9090501e66f10931faf471c601192a9baf3 Mon Sep 17 00:00:00 2001 From: Y Date: Sat, 5 Oct 2024 17:17:56 -0400 Subject: [PATCH 06/16] improve the search button on the search page --- apps/static/css/readux2/search.scss | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/static/css/readux2/search.scss b/apps/static/css/readux2/search.scss index 55d68a1e..29eba034 100644 --- a/apps/static/css/readux2/search.scss +++ b/apps/static/css/readux2/search.scss @@ -127,10 +127,6 @@ form#search-form input[type="search"][name="q"] { width: 100%; } -.uk-button-default { - font-size: 1.25rem; -} - #search-grid { gap: 1.5rem; } @@ -249,4 +245,20 @@ ol#search-results dl { .selectize-control.plugin-clear_button .clear { height: 85%; +} + +.search-button { + background-color: #E60000; + color: white; + padding: 0 9px; + border:none; + height: 40px; + font-size: 1.25rem; + transition: ease 0.1s; + &:hover { + background-color: darken(#E60000, 10%); + } + &:active { + background-color: darken(#E60000, 25%); + } } \ No newline at end of file From d62683432f68129cb0cdedecb2efc2e6648e4fa1 Mon Sep 17 00:00:00 2001 From: Y Date: Sat, 5 Oct 2024 17:18:21 -0400 Subject: [PATCH 07/16] remove inline style for a button --- apps/templates/search_results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/templates/search_results.html b/apps/templates/search_results.html index 99d63494..b5204078 100644 --- a/apps/templates/search_results.html +++ b/apps/templates/search_results.html @@ -82,7 +82,7 @@
    -
    From 7bdba2261c5fefdd73aa5566e5e4fb130882814c Mon Sep 17 00:00:00 2001 From: Y Date: Sat, 5 Oct 2024 17:37:37 -0400 Subject: [PATCH 08/16] improve password reset page --- apps/static/css/readux2/main.scss | 4 ++ apps/templates/account/password_reset.html | 56 +++++++++++++++++++--- 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/apps/static/css/readux2/main.scss b/apps/static/css/readux2/main.scss index d586b0dc..98537eb2 100644 --- a/apps/static/css/readux2/main.scss +++ b/apps/static/css/readux2/main.scss @@ -624,4 +624,8 @@ iframe { &:active { background-color: darken(#E60000, 25%); } +} + +.justify-content-normal { + justify-content: normal !important; } \ No newline at end of file diff --git a/apps/templates/account/password_reset.html b/apps/templates/account/password_reset.html index 845bbda7..70897e45 100644 --- a/apps/templates/account/password_reset.html +++ b/apps/templates/account/password_reset.html @@ -1,26 +1,68 @@ {% extends "account/base.html" %} - +{% load sass_tags %} {% load i18n %} {% load account %} {% load crispy_forms_tags %} {% block head_title %}{% trans "Password Reset" %}{% endblock %} +{% block extra_javascript %} + +{% endblock %} + {% block inner %} + + {% include '_home/_nav.html' %} + +
    + + + + +

    {% trans "Password Reset" %}

    -

    {% trans "Password Reset" %}

    {% if user.is_authenticated %} {% include "account/snippets/already_logged_in.html" %} {% endif %}

    {% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

    -
    + {% csrf_token %} - {{ form|crispy }} - -
    + +
    + + +
    + + +
    + + +
    + + +
    +

    {% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

    +
    + -

    {% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

    +
    {% endblock %} From 0e655e2e7f4a47b3edd62007c32c155818170bcd Mon Sep 17 00:00:00 2001 From: Y Date: Sat, 5 Oct 2024 17:38:04 -0400 Subject: [PATCH 09/16] left justified for the sign up page action buttons --- apps/templates/account/signup.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/templates/account/signup.html b/apps/templates/account/signup.html index e10955ed..5228cc6d 100644 --- a/apps/templates/account/signup.html +++ b/apps/templates/account/signup.html @@ -76,7 +76,7 @@

    {% trans "Sign Up" {% endif %} -
    +
    From 891cf5003f6be9c627f9d5a4ed16360b56741d36 Mon Sep 17 00:00:00 2001 From: Y Date: Sat, 5 Oct 2024 17:43:41 -0400 Subject: [PATCH 10/16] improve password reset done (confirmation) page --- .../account/password_reset_done.html | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/templates/account/password_reset_done.html b/apps/templates/account/password_reset_done.html index c59534af..0af22bc9 100644 --- a/apps/templates/account/password_reset_done.html +++ b/apps/templates/account/password_reset_done.html @@ -1,4 +1,5 @@ {% extends "account/base.html" %} +{% load sass_tags %} {% load i18n %} {% load account %} @@ -6,12 +7,28 @@ {% block head_title %}{% trans "Password Reset" %}{% endblock %} {% block inner %} -

    {% trans "Password Reset" %}

    + + +{% include '_home/_nav.html' %} + +
    + + + + + +

    {% trans "Password Reset" %}

    {% if user.is_authenticated %} {% include "account/snippets/already_logged_in.html" %} {% endif %} -

    {% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    +

    {% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    +
    + +
    {% endblock %} From 6e6676d18c64551a9c827f33f0b3d8820ef6b698 Mon Sep 17 00:00:00 2001 From: Y Date: Sat, 5 Oct 2024 17:48:28 -0400 Subject: [PATCH 11/16] improve set password page --- apps/templates/account/password_set.html | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/templates/account/password_set.html b/apps/templates/account/password_set.html index 7786e9e5..336a2fed 100644 --- a/apps/templates/account/password_set.html +++ b/apps/templates/account/password_set.html @@ -1,4 +1,5 @@ {% extends "account/base.html" %} +{% load sass_tags %} {% load i18n %} {% load crispy_forms_tags %} @@ -6,12 +7,26 @@ {% block head_title %}{% trans "Set Password" %}{% endblock %} {% block inner %} -

    {% trans "Set Password" %}

    + +{% include '_home/_nav.html' %} + +
    + + + + + +

    {% trans "Set Password" %}

    {% csrf_token %} {{ form|crispy }}
    + +
    {% endblock %} From 52e920019af9997bd78057050ea043340ecde3db Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Mon, 14 Oct 2024 13:30:09 -0400 Subject: [PATCH 12/16] Allow custom background image via wagtail --- .../0008_homepage_background_image.py | 27 +++++++++++++++++++ apps/cms/models.py | 10 +++++++ apps/templates/_home/_nav.html | 2 +- apps/templates/cms/home_page.html | 12 ++++----- 4 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 apps/cms/migrations/0008_homepage_background_image.py diff --git a/apps/cms/migrations/0008_homepage_background_image.py b/apps/cms/migrations/0008_homepage_background_image.py new file mode 100644 index 00000000..5091b89b --- /dev/null +++ b/apps/cms/migrations/0008_homepage_background_image.py @@ -0,0 +1,27 @@ +# Generated by Django 3.2.25 on 2024-10-14 17:20 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailimages", "0025_alter_image_file_alter_rendition_file"), + ("cms", "0007_homepage_featured_video"), + ] + + operations = [ + migrations.AddField( + model_name="homepage", + name="background_image", + field=models.ForeignKey( + blank=True, + help_text="Optional background image for the site header", + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="wagtailimages.image", + ), + ), + ] diff --git a/apps/cms/models.py b/apps/cms/models.py index 9306d333..08f6bdea 100644 --- a/apps/cms/models.py +++ b/apps/cms/models.py @@ -257,6 +257,15 @@ class HomePage(Page): collections = Collection.objects.all()[:8] volumes = Manifest.objects.all()[:8] + background_image = models.ForeignKey( + 'wagtailimages.Image', + null=True, + blank=True, + on_delete=models.SET_NULL, + related_name='+', + help_text="Optional background image for the site header", + ) + featured_story_title = models.CharField( help_text="Title of the featured story", blank=True, max_length=255 ) @@ -286,6 +295,7 @@ class HomePage(Page): content_panels = Page.content_panels + [ FieldPanel('tagline', classname="full"), + FieldPanel('background_image', classname="full"), FieldPanel('content_display', classname="full"), AutocompletePanel('featured_collections', target_model="kollections.Collection"), FieldPanel('featured_collections_sort_order', classname="full"), diff --git a/apps/templates/_home/_nav.html b/apps/templates/_home/_nav.html index 2f7fe078..688b6ee6 100644 --- a/apps/templates/_home/_nav.html +++ b/apps/templates/_home/_nav.html @@ -6,7 +6,7 @@
    {% main_menu add_sub_menus_inline=True %} diff --git a/apps/templates/cms/home_page.html b/apps/templates/cms/home_page.html index c15a5574..e12b30ec 100644 --- a/apps/templates/cms/home_page.html +++ b/apps/templates/cms/home_page.html @@ -1,10 +1,5 @@ {% extends "base.html" %} -{% load static %} -{% load readux_templatetags %} -{% load wagtailcore_tags %} -{% load has_user_annotations %} -{% load user_annotation_count %} -{% load sass_tags %} +{% load has_user_annotations readux_templatetags sass_tags static user_annotation_count wagtailcore_tags wagtailimages_tags %} {% block extra_css %} {% endblock %} @@ -12,7 +7,10 @@ {% block content %} {% if request.path == '/' %} -
    +
    {% include '_home/_nav.html' %} From cf125649444627d4774319e6416f8886fbdeca18 Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Mon, 14 Oct 2024 13:32:50 -0400 Subject: [PATCH 13/16] Ensure background-size: cover on bg image --- apps/templates/cms/home_page.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/templates/cms/home_page.html b/apps/templates/cms/home_page.html index e12b30ec..d0c8de8d 100644 --- a/apps/templates/cms/home_page.html +++ b/apps/templates/cms/home_page.html @@ -9,7 +9,7 @@ {% if request.path == '/' %}
    From bbfaf857883297df3818ab1d811e1c00c90f21e1 Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Mon, 21 Oct 2024 12:49:38 -0400 Subject: [PATCH 14/16] bugfix: remove duplicate footer --- apps/templates/cms/home_page.html | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/templates/cms/home_page.html b/apps/templates/cms/home_page.html index d0c8de8d..4ed2a4a4 100644 --- a/apps/templates/cms/home_page.html +++ b/apps/templates/cms/home_page.html @@ -29,7 +29,6 @@ {% if page.featured_video_url %} {% include '_home/_video.html' %} {% endif %} - {% include '_home/_footer.html' %}
    {% endif %} From 144bb9de1ac785c7e2973fec7bd65d1976f2ad5a Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Mon, 21 Oct 2024 13:14:15 -0400 Subject: [PATCH 15/16] bugfix: revise fix for duplicate footer on homepage --- apps/templates/base.html | 5 ++++- apps/templates/cms/home_page.html | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/templates/base.html b/apps/templates/base.html index 92a3b3f0..aa503d59 100644 --- a/apps/templates/base.html +++ b/apps/templates/base.html @@ -124,7 +124,10 @@ {% block viewer %}{% endblock viewer %} - {% include '_home/_footer.html' %} + {# prevent duplicate footer on homepage bug #} + {% if request.path != '/'%} + {% include '_home/_footer.html' %} + {% endif %}
    diff --git a/apps/templates/cms/home_page.html b/apps/templates/cms/home_page.html index 4ed2a4a4..d0c8de8d 100644 --- a/apps/templates/cms/home_page.html +++ b/apps/templates/cms/home_page.html @@ -29,6 +29,7 @@ {% if page.featured_video_url %} {% include '_home/_video.html' %} {% endif %} + {% include '_home/_footer.html' %}
    {% endif %} From e735964621bf163928eccea9972c633d66329c34 Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Mon, 21 Oct 2024 13:24:08 -0400 Subject: [PATCH 16/16] bugfix: fixes for homepage with no content --- apps/static/css/readux2/main.scss | 9 +++++++++ apps/templates/cms/home_page.html | 1 + 2 files changed, 10 insertions(+) diff --git a/apps/static/css/readux2/main.scss b/apps/static/css/readux2/main.scss index 98537eb2..4ca15ce9 100644 --- a/apps/static/css/readux2/main.scss +++ b/apps/static/css/readux2/main.scss @@ -38,6 +38,15 @@ main { .content { position: relative; z-index: 2; + min-height: 100vh; + display: flex; + flex-flow: column; + .space { + flex-grow: 1; + } + .uk-section-default:empty { + background-color: transparent; + } } .paragraph { diff --git a/apps/templates/cms/home_page.html b/apps/templates/cms/home_page.html index d0c8de8d..3ed11483 100644 --- a/apps/templates/cms/home_page.html +++ b/apps/templates/cms/home_page.html @@ -29,6 +29,7 @@ {% if page.featured_video_url %} {% include '_home/_video.html' %} {% endif %} +
    {% include '_home/_footer.html' %}