From 9f21a02aa12ad1e714706f79b993f4a668fa9369 Mon Sep 17 00:00:00 2001 From: StephDriver <5330770+StephDriver@users.noreply.github.com> Date: Fri, 12 Sep 2025 15:23:25 +0100 Subject: [PATCH 1/7] a11y: #4839 full-text-search add pagination --- src/journal/views.py | 23 ++++++++++++++++++- .../templates/journal/full-text-search.html | 6 +++-- .../templates/journal/full-text-search.html | 6 +++-- .../templates/journal/full-text-search.html | 5 +++- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/journal/views.py b/src/journal/views.py index 32109a44e9..0311ea0e0b 100755 --- a/src/journal/views.py +++ b/src/journal/views.py @@ -2220,6 +2220,9 @@ def full_text_search(request): search_term, keyword, sort, form, redir = logic.handle_search_controls( request, ) + + form.id = "search_form" + if search_term: form.is_valid() articles = submission_models.Article.objects.search( @@ -2229,12 +2232,30 @@ def full_text_search(request): site=request.site_object, ) + paginate_by = request.GET.get("paginate_by", 25) + if paginate_by == "all": + paginate_by = len(articles) if articles else 25 + + paginator = Paginator(articles, paginate_by) + page_number = request.GET.get("page") + + try: + page_obj = paginator.get_page(page_number) + except (EmptyPage, PageNotAnInteger): + page_obj = paginator.get_page(1) + template = "journal/full-text-search.html" context = { - "articles": articles, + "articles": page_obj, + "page_obj": page_obj, + "is_paginated": page_obj.has_other_pages(), + "paginate_by": paginate_by, "article_search": search_term, "keyword": keyword, "form": form, + "facet_form": form, + "order_by_choices": form.fields["sort"].choices, + "order_by": sort, } return render(request, template, context) diff --git a/src/themes/OLH/templates/journal/full-text-search.html b/src/themes/OLH/templates/journal/full-text-search.html index 8a9b80526c..6cb8abfc35 100644 --- a/src/themes/OLH/templates/journal/full-text-search.html +++ b/src/themes/OLH/templates/journal/full-text-search.html @@ -27,12 +27,14 @@

{% trans 'All Articles' %}

{% empty %}

{% trans 'No articles to display' %}.

{% endfor %} - + {% if articles %} + {% include "elements/pagination.html" with form_id=facet_form.id %} + {% endif %}
-
+
{% if not keyword %} {% include 'elements/forms/errors.html' with form=form%} diff --git a/src/themes/clean/templates/journal/full-text-search.html b/src/themes/clean/templates/journal/full-text-search.html index 4bd348d69e..565c0fc78f 100644 --- a/src/themes/clean/templates/journal/full-text-search.html +++ b/src/themes/clean/templates/journal/full-text-search.html @@ -27,12 +27,14 @@

{% trans 'Article Search Results' %}

{% empty %}

{% trans "No articles to display" %}.

{% endfor %} - + {% if articles %} + {% include "elements/pagination.html" with form_id=facet_form.id %} + {% endif %}
- +
{% if not keyword %} {% include 'elements/forms/errors.html' with form=form%} diff --git a/src/themes/material/templates/journal/full-text-search.html b/src/themes/material/templates/journal/full-text-search.html index a6581d0195..3f7a0024ad 100644 --- a/src/themes/material/templates/journal/full-text-search.html +++ b/src/themes/material/templates/journal/full-text-search.html @@ -27,13 +27,16 @@

{% trans 'Article Search Results' %}

{% empty %}

{% trans "No articles to display." %}

{% endfor %} + {% if articles %} + {% include "elements/pagination.html" with form_id=facet_form.id %} + {% endif %}
- +
{% if not keyword %} {{ form|materializecss }} From 7e802539db4645ffa43fec7b897224c7fd2c2b88 Mon Sep 17 00:00:00 2001 From: StephDriver <5330770+StephDriver@users.noreply.github.com> Date: Fri, 12 Sep 2025 15:31:59 +0100 Subject: [PATCH 2/7] a11y: #4839 full-text-search add landmarks --- src/themes/OLH/assets/scss/app.scss | 5 +++ .../templates/journal/full-text-search.html | 36 ++++++++++-------- .../templates/journal/full-text-search.html | 34 +++++++++-------- .../templates/journal/full-text-search.html | 37 ++++++++++--------- 4 files changed, 64 insertions(+), 48 deletions(-) diff --git a/src/themes/OLH/assets/scss/app.scss b/src/themes/OLH/assets/scss/app.scss index 111d5dcf70..972c684388 100755 --- a/src/themes/OLH/assets/scss/app.scss +++ b/src/themes/OLH/assets/scss/app.scss @@ -1483,3 +1483,8 @@ span + .btn-background { -o-transition: all 1s ease; -ms-transition: all 1s ease; } + +section.invisible-landmark{ + padding: 0; + margin: 0; +} \ No newline at end of file diff --git a/src/themes/OLH/templates/journal/full-text-search.html b/src/themes/OLH/templates/journal/full-text-search.html index 6cb8abfc35..08373775c8 100644 --- a/src/themes/OLH/templates/journal/full-text-search.html +++ b/src/themes/OLH/templates/journal/full-text-search.html @@ -20,21 +20,24 @@

{% trans 'All Articles' %}

{% endif %}
-
- - {% for article in articles %} - {% include "elements/journal/box_article.html" with article=article %} - {% empty %} -

{% trans 'No articles to display' %}.

- {% endfor %} - {% if articles %} - {% include "elements/pagination.html" with form_id=facet_form.id %} - {% endif %} -
+
+
+ + {% for article in articles %} + {% include "elements/journal/box_article.html" with article=article %} + {% empty %} +

{% trans 'No articles to display' %}.

+ {% endfor %} + {% if articles %} + {% include "elements/pagination.html" with form_id=facet_form.id %} + {% endif %} +
+
-
-
- +
+
+
+
{% if not keyword %} {% include 'elements/forms/errors.html' with form=form%} @@ -73,9 +76,10 @@

{% trans 'All Articles' %}

- + +
-
+
diff --git a/src/themes/clean/templates/journal/full-text-search.html b/src/themes/clean/templates/journal/full-text-search.html index 565c0fc78f..53c1c8b4fb 100644 --- a/src/themes/clean/templates/journal/full-text-search.html +++ b/src/themes/clean/templates/journal/full-text-search.html @@ -21,20 +21,23 @@

{% trans 'Article Search Results' %}

- - {% for article in articles %} - {% include "elements/article_listing.html" with article=article %} - {% empty %} -

{% trans "No articles to display" %}.

- {% endfor %} - {% if articles %} - {% include "elements/pagination.html" with form_id=facet_form.id %} - {% endif %} -
+
+ + {% for article in articles %} + {% include "elements/article_listing.html" with article=article %} + {% empty %} +

{% trans "No articles to display" %}.

+ {% endfor %} + {% if articles %} + {% include "elements/pagination.html" with form_id=facet_form.id %} + {% endif %} +
+
-
-
-
+
+
+
+
{% if not keyword %} {% include 'elements/forms/errors.html' with form=form%} @@ -62,9 +65,10 @@

{% trans 'Article Search Results' %}

- + +
-
+
{% endblock %} diff --git a/src/themes/material/templates/journal/full-text-search.html b/src/themes/material/templates/journal/full-text-search.html index 3f7a0024ad..6f53104d57 100644 --- a/src/themes/material/templates/journal/full-text-search.html +++ b/src/themes/material/templates/journal/full-text-search.html @@ -20,23 +20,25 @@

{% trans 'Article Search Results' %}

{% endif %}
-
+
+
- {% for article in articles %} - {% include "elements/article_listing.html" with article=article %} - {% empty %} -

{% trans "No articles to display." %}

- {% endfor %} - {% if articles %} - {% include "elements/pagination.html" with form_id=facet_form.id %} - {% endif %} - -
+ {% for article in articles %} + {% include "elements/article_listing.html" with article=article %} + {% empty %} +

{% trans "No articles to display." %}

+ {% endfor %} + {% if articles %} + {% include "elements/pagination.html" with form_id=facet_form.id %} + {% endif %} +
+
-
-
-
-
+
+
+
+
+
{% if not keyword %} {{ form|materializecss }} @@ -69,10 +71,11 @@

{% trans 'Article Search Results' %}

- + +
-
+
{% endblock %} From 8d7d7e4dbae77408a1d0117f37807780e2e0cb5d Mon Sep 17 00:00:00 2001 From: StephDriver <5330770+StephDriver@users.noreply.github.com> Date: Fri, 12 Sep 2025 15:37:38 +0100 Subject: [PATCH 3/7] a11y: #4839 full-text-search alignment fix --- .../templates/journal/full-text-search.html | 18 ++++++++++-------- .../templates/journal/full-text-search.html | 1 - .../templates/journal/full-text-search.html | 18 ++++++++++-------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/themes/OLH/templates/journal/full-text-search.html b/src/themes/OLH/templates/journal/full-text-search.html index 08373775c8..e387fad212 100644 --- a/src/themes/OLH/templates/journal/full-text-search.html +++ b/src/themes/OLH/templates/journal/full-text-search.html @@ -10,19 +10,21 @@ {% block title %}{% trans "Search" %}{% endblock %} {% block body %} +
- {% if search_term %} -

Searching for: {{ search_term }}

- {% elif keyword %} -

Keyword: {{ keyword }}

- {% else %} -

{% trans 'All Articles' %}

- {% endif %}
+
+ {% if search_term %} +

Searching for: {{ search_term }}

+ {% elif keyword %} +

Keyword: {{ keyword }}

+ {% else %} +

{% trans 'All Articles' %}

+ {% endif %} +
- {% for article in articles %} {% include "elements/journal/box_article.html" with article=article %} {% empty %} diff --git a/src/themes/clean/templates/journal/full-text-search.html b/src/themes/clean/templates/journal/full-text-search.html index 53c1c8b4fb..8e5f972f69 100644 --- a/src/themes/clean/templates/journal/full-text-search.html +++ b/src/themes/clean/templates/journal/full-text-search.html @@ -22,7 +22,6 @@

{% trans 'Article Search Results' %}

- {% for article in articles %} {% include "elements/article_listing.html" with article=article %} {% empty %} diff --git a/src/themes/material/templates/journal/full-text-search.html b/src/themes/material/templates/journal/full-text-search.html index 6f53104d57..82cb22080e 100644 --- a/src/themes/material/templates/journal/full-text-search.html +++ b/src/themes/material/templates/journal/full-text-search.html @@ -11,18 +11,20 @@ {% block body %} -

{% trans 'Article Search Results' %}

- - {% if search_term %} -

{% trans 'Searching for' %}: {{ search_term }}

- {% elif keyword %} -

{% trans 'Keyword' %}: {{ keyword }}

- {% endif %} +
+
+

{% trans 'Article Search Results' %}

+ {% if search_term %} +

{% trans 'Searching for' %}: {{ search_term }}

+ {% elif keyword %} +

{% trans 'Keyword' %}: {{ keyword }}

+ {% endif %} +
+
- {% for article in articles %} {% include "elements/article_listing.html" with article=article %} {% empty %} From 2bf1a1bf331ba87811630c311912014e82c0def4 Mon Sep 17 00:00:00 2001 From: StephDriver <5330770+StephDriver@users.noreply.github.com> Date: Fri, 12 Sep 2025 15:52:26 +0100 Subject: [PATCH 4/7] a11y: #4839 full-text-search olh contextual h1 --- src/themes/OLH/templates/journal/full-text-search.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/themes/OLH/templates/journal/full-text-search.html b/src/themes/OLH/templates/journal/full-text-search.html index e387fad212..1678b7b9ef 100644 --- a/src/themes/OLH/templates/journal/full-text-search.html +++ b/src/themes/OLH/templates/journal/full-text-search.html @@ -20,7 +20,7 @@

Searching for: {{ search_term }}

{% elif keyword %}

Keyword: {{ keyword }}

{% else %} -

{% trans 'All Articles' %}

+

{% trans 'Article Search Results' %}

{% endif %}
From 2706f0147986cedbb3c589ecbca72c68c95f7db1 Mon Sep 17 00:00:00 2001 From: StephDriver <5330770+StephDriver@users.noreply.github.com> Date: Fri, 12 Sep 2025 15:59:19 +0100 Subject: [PATCH 5/7] a11y: #4839 full-text-search report number of results --- src/themes/OLH/templates/journal/full-text-search.html | 9 +++++++++ src/themes/clean/templates/journal/full-text-search.html | 9 +++++++++ .../material/templates/journal/full-text-search.html | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/src/themes/OLH/templates/journal/full-text-search.html b/src/themes/OLH/templates/journal/full-text-search.html index 1678b7b9ef..0bebf0fefb 100644 --- a/src/themes/OLH/templates/journal/full-text-search.html +++ b/src/themes/OLH/templates/journal/full-text-search.html @@ -39,6 +39,15 @@

{% trans 'Article Search Results' %}

+
+

+ {% blocktrans count result_count=page_obj.paginator.count %} + 1 result + {% plural %} + {{ result_count }} results + {% endblocktrans %} +

+
{% if not keyword %} diff --git a/src/themes/clean/templates/journal/full-text-search.html b/src/themes/clean/templates/journal/full-text-search.html index 8e5f972f69..9d3de8c698 100644 --- a/src/themes/clean/templates/journal/full-text-search.html +++ b/src/themes/clean/templates/journal/full-text-search.html @@ -36,6 +36,15 @@

{% trans 'Article Search Results' %}

+
+

+ {% blocktrans count result_count=page_obj.paginator.count %} + 1 result + {% plural %} + {{ result_count }} results + {% endblocktrans %} +

+
{% if not keyword %} diff --git a/src/themes/material/templates/journal/full-text-search.html b/src/themes/material/templates/journal/full-text-search.html index 82cb22080e..3e4bb20837 100644 --- a/src/themes/material/templates/journal/full-text-search.html +++ b/src/themes/material/templates/journal/full-text-search.html @@ -40,6 +40,15 @@

{% trans 'Article Search Results' %}

+
+

+ {% blocktrans count result_count=page_obj.paginator.count %} + 1 result + {% plural %} + {{ result_count }} results + {% endblocktrans %} +

+
{% if not keyword %} From ac8090d7d8514776fbbaec419f98ac4687586f80 Mon Sep 17 00:00:00 2001 From: StephDriver <5330770+StephDriver@users.noreply.github.com> Date: Tue, 23 Sep 2025 09:22:33 +0100 Subject: [PATCH 6/7] a11y: #4839 full-text-search use form not facet_form --- src/themes/OLH/templates/journal/full-text-search.html | 2 +- src/themes/clean/templates/journal/full-text-search.html | 2 +- src/themes/material/templates/journal/full-text-search.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/themes/OLH/templates/journal/full-text-search.html b/src/themes/OLH/templates/journal/full-text-search.html index 0bebf0fefb..7a527827eb 100644 --- a/src/themes/OLH/templates/journal/full-text-search.html +++ b/src/themes/OLH/templates/journal/full-text-search.html @@ -31,7 +31,7 @@

{% trans 'Article Search Results' %}

{% trans 'No articles to display' %}.

{% endfor %} {% if articles %} - {% include "elements/pagination.html" with form_id=facet_form.id %} + {% include "elements/pagination.html" with form_id=form.id %} {% endif %}
diff --git a/src/themes/clean/templates/journal/full-text-search.html b/src/themes/clean/templates/journal/full-text-search.html index 9d3de8c698..3898f777ef 100644 --- a/src/themes/clean/templates/journal/full-text-search.html +++ b/src/themes/clean/templates/journal/full-text-search.html @@ -28,7 +28,7 @@

{% trans 'Article Search Results' %}

{% trans "No articles to display" %}.

{% endfor %} {% if articles %} - {% include "elements/pagination.html" with form_id=facet_form.id %} + {% include "elements/pagination.html" with form_id=form.id %} {% endif %}
diff --git a/src/themes/material/templates/journal/full-text-search.html b/src/themes/material/templates/journal/full-text-search.html index 3e4bb20837..0d482e708f 100644 --- a/src/themes/material/templates/journal/full-text-search.html +++ b/src/themes/material/templates/journal/full-text-search.html @@ -31,7 +31,7 @@

{% trans 'Article Search Results' %}

{% trans "No articles to display." %}

{% endfor %} {% if articles %} - {% include "elements/pagination.html" with form_id=facet_form.id %} + {% include "elements/pagination.html" with form_id=form.id %} {% endif %}
From ec0b61780506f953cbacbeedb35988eddfa978ec Mon Sep 17 00:00:00 2001 From: StephDriver <5330770+StephDriver@users.noreply.github.com> Date: Tue, 23 Sep 2025 09:29:19 +0100 Subject: [PATCH 7/7] a11y: #4839 full-text-search move id from view to class --- src/journal/forms.py | 2 ++ src/journal/views.py | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/journal/forms.py b/src/journal/forms.py index d571b63969..101d08232e 100755 --- a/src/journal/forms.py +++ b/src/journal/forms.py @@ -98,6 +98,8 @@ def __init__(self, data=None, *args, **kwargs): self.data[search_filter] = "on" self.label_suffix = "" + self.id = "search_form" + article_search = forms.CharField( label=_("Search term"), min_length=3, max_length=100, required=False ) diff --git a/src/journal/views.py b/src/journal/views.py index 0311ea0e0b..a1c3643490 100755 --- a/src/journal/views.py +++ b/src/journal/views.py @@ -2221,8 +2221,6 @@ def full_text_search(request): request, ) - form.id = "search_form" - if search_term: form.is_valid() articles = submission_models.Article.objects.search( @@ -2250,12 +2248,9 @@ def full_text_search(request): "page_obj": page_obj, "is_paginated": page_obj.has_other_pages(), "paginate_by": paginate_by, - "article_search": search_term, + "search_term": search_term, "keyword": keyword, "form": form, - "facet_form": form, - "order_by_choices": form.fields["sort"].choices, - "order_by": sort, } return render(request, template, context)