diff --git a/config/views.py b/config/views.py index b43dfaf84..14fd8565a 100644 --- a/config/views.py +++ b/config/views.py @@ -70,7 +70,8 @@ class StructuredSearchView(TemplateViewWithContext): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context["context"]["courts"] = courts.get_selectable() + context["context"]["courts"] = courts.get_grouped_selectable_courts() + context["context"]["tribunals"] = courts.get_grouped_selectable_tribunals() context["feedback_survey_type"] = "structured_search" return context diff --git a/ds_judgements_public_ui/sass/includes/_structured_search.scss b/ds_judgements_public_ui/sass/includes/_structured_search.scss index d2ebe6799..2f876518f 100644 --- a/ds_judgements_public_ui/sass/includes/_structured_search.scss +++ b/ds_judgements_public_ui/sass/includes/_structured_search.scss @@ -198,11 +198,15 @@ width: 100%; @media (min-width: $grid__breakpoint-medium) { - column-count: 2; - column-gap: calc(2 * $spacer__unit); + display: flex; + gap: calc(2 * $spacer__unit); } } + &__court-options-column { + break-inside: avoid; + } + &__court-option { margin-top: calc($spacer__unit * 0.5); @@ -252,8 +256,22 @@ } } + &__court-group-label { + margin-top: calc(0.5 * $spacer__unit); + line-height: calc(1.5 * $spacer__unit); + vertical-align: baseline; + margin-bottom: calc(0.5 * $spacer__unit); + } + + &__court-group { + margin-left: calc(2 * $spacer__unit); + break-inside: avoid; + } + &__court-option-label { margin-left: calc(0.5 * $spacer__unit); + line-height: calc(1.5 * $spacer__unit); + vertical-align: baseline; } &__court-date-range { color: $color__dark-grey; diff --git a/ds_judgements_public_ui/templates/includes/browse_by_court.html b/ds_judgements_public_ui/templates/includes/browse_by_court.html index a3bb6f077..43eb501df 100644 --- a/ds_judgements_public_ui/templates/includes/browse_by_court.html +++ b/ds_judgements_public_ui/templates/includes/browse_by_court.html @@ -9,7 +9,7 @@

By court

{% for court in courts %}
  • {{ court.list_name }} + href="{% url "search" %}?court={{ court.canonical_param }}">{{ court.name }} — {{ court|get_court_date_range }}
  • {% endfor %} @@ -24,7 +24,7 @@

    By tribunal

    {% for tribunal in tribunals %}
  • {{ tribunal.list_name }} + href="{% url "search" %}?court={{ tribunal.canonical_param }}">{{ tribunal.name }} — {{ tribunal|get_court_date_range }}
  • {% endfor %} diff --git a/ds_judgements_public_ui/templates/includes/court_option.html b/ds_judgements_public_ui/templates/includes/court_option.html new file mode 100644 index 000000000..82e7e96a5 --- /dev/null +++ b/ds_judgements_public_ui/templates/includes/court_option.html @@ -0,0 +1,14 @@ +{% load query_filters court_utils %} +
    + +
    diff --git a/ds_judgements_public_ui/templates/includes/courts_options.html b/ds_judgements_public_ui/templates/includes/courts_options.html index 6ec734c34..8fbfc93f7 100644 --- a/ds_judgements_public_ui/templates/includes/courts_options.html +++ b/ds_judgements_public_ui/templates/includes/courts_options.html @@ -1,16 +1,14 @@ -{% load query_filters court_utils %} -{% for court in context.courts %} -
    - -
    +{% for group in courts %} + {% if group.display_heading %} +
    {{ group.name }}
    +
    + {% for court in group.courts %} + {% include "includes/court_option.html" with court=court %} + {% endfor %} +
    + {% else %} + {% for court in group.courts %} + {% include "includes/court_option.html" with court=court ungrouped=True %} + {% endfor %} + {% endif %} {% endfor %} diff --git a/ds_judgements_public_ui/templates/includes/results_filters_inputs.html b/ds_judgements_public_ui/templates/includes/results_filters_inputs.html index 9769b660f..e9f05913b 100644 --- a/ds_judgements_public_ui/templates/includes/results_filters_inputs.html +++ b/ds_judgements_public_ui/templates/includes/results_filters_inputs.html @@ -78,7 +78,14 @@
    From specific courts or tribunals -
    {% include "includes/courts_options.html" %}
    +
    +
    + {% include "includes/courts_options.html" with courts=context.courts %} +
    +
    + {% include "includes/courts_options.html" with courts=context.tribunals %} +
    +
    diff --git a/ds_judgements_public_ui/templates/pages/about_this_service.html b/ds_judgements_public_ui/templates/pages/about_this_service.html index 0098190c4..ff64991e5 100644 --- a/ds_judgements_public_ui/templates/pages/about_this_service.html +++ b/ds_judgements_public_ui/templates/pages/about_this_service.html @@ -89,15 +89,15 @@

    Current coverage of courts and tribunals available on

    Date ranges for judgments and decisions available on Find Case Law

    diff --git a/judgments/tests/test_search.py b/judgments/tests/test_search.py index 13f481265..5a47e3197 100644 --- a/judgments/tests/test_search.py +++ b/judgments/tests/test_search.py @@ -103,10 +103,10 @@ def test_judgment_advanced_search_court_filters( draggable="false" class="results-search-component__removable-options-link" href="/judgments/search?query=&court=ewhc/ipec&judge=&party=&neutral_citation=&specific_keyword=&order=&from=&from_day=&from_month=&from_year=&to=&to_day=&to_month=&to_year=&per_page=&page=" - title="Chancery Division of the High Court"> + title="High Court (Chancery Division)"> - Chancery Division of the High Court + High Court (Chancery Division) @@ -118,10 +118,10 @@ def test_judgment_advanced_search_court_filters( draggable="false" class="results-search-component__removable-options-link" href="/judgments/search?query=&court=ewhc/ch&judge=&party=&neutral_citation=&specific_keyword=&order=&from=&from_day=&from_month=&from_year=&to=&to_day=&to_month=&to_year=&per_page=&page=" - title="Intellectual Property Enterprise Court"> + title="High Court (Intellectual Property Enterprise Court)"> - Intellectual Property Enterprise Court + High Court (Intellectual Property Enterprise Court) diff --git a/judgments/views/advanced_search.py b/judgments/views/advanced_search.py index 082ac674a..6f56c5c0d 100644 --- a/judgments/views/advanced_search.py +++ b/judgments/views/advanced_search.py @@ -96,7 +96,8 @@ def advanced_search(request): context = { "errors": errors, "query": query_params["query"], - "courts": all_courts.get_selectable(), + "courts": all_courts.get_grouped_selectable_courts(), + "tribunals": all_courts.get_grouped_selectable_tribunals(), "query_params": query_params, } diff --git a/judgments/views/browse.py b/judgments/views/browse.py index 3a192b0a1..0f4799eac 100644 --- a/judgments/views/browse.py +++ b/judgments/views/browse.py @@ -49,8 +49,8 @@ def browse(request, court=None, subdivision=None, year=None): context["total"] = search_response.total context["per_page"] = per_page context["paginator"] = paginator(page, search_response.total, per_page) - context["courts"] = all_courts.get_selectable() - + context["courts"] = all_courts.get_grouped_selectable_courts() + context["tribunals"] = all_courts.get_grouped_selectable_tribunals() context["page_title"] = gettext("results.search.title") except MarklogicResourceNotFoundError: diff --git a/requirements/base.txt b/requirements/base.txt index 086f5d674..65da55af8 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -15,7 +15,7 @@ requests-toolbelt~=1.0.0 lxml~=4.9.3 wsgi-basic-auth~=1.1.0 ds-caselaw-marklogic-api-client~=14.1.0 -ds-caselaw-utils~=1.0.2 +ds-caselaw-utils==1.2.1 rollbar django-weasyprint==2.2.0 # pinned to avoid https://github.com/fdemmer/django-weasyprint/issues/71