Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paginated legislation listing #1901

Merged
merged 50 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e800fc0
adds paginated legislation listing
actlikewill Jul 9, 2024
754a0b4
adds children dropdown
actlikewill Jul 12, 2024
dadf2d8
changes liiweb legislation template
actlikewill Jul 12, 2024
2a07642
uses htmx for facets
actlikewill Jul 12, 2024
2ade5bc
bring legislation features into base _document_table
longhotsummer Jul 15, 2024
8ecb05a
caret and collapse for children
longhotsummer Jul 15, 2024
05520ad
grouping
longhotsummer Jul 15, 2024
6ef34ca
Merge pull request #1904 from laws-africa/doc-table
actlikewill Jul 15, 2024
5bacb67
common grouping mechanism for courts
longhotsummer Jul 15, 2024
df6219b
fix latest_expression_only for legislation view
longhotsummer Jul 15, 2024
8440f35
htmx included in app.ts
longhotsummer Jul 15, 2024
1816f3d
Merge pull request #1905 from laws-africa/grouping
longhotsummer Jul 15, 2024
6c6cbb2
sorting for document filter table
longhotsummer Jul 15, 2024
2dc98f2
doc-table sorting
longhotsummer Jul 15, 2024
1bf4be9
sort is possible with alphabet filter
longhotsummer Jul 15, 2024
77c1872
adds facet values
actlikewill Jul 15, 2024
c5a42e5
Merge branch 'listing' into sort
longhotsummer Jul 15, 2024
0751fbd
sorting
longhotsummer Jul 15, 2024
10e9e4e
fix tests
longhotsummer Jul 16, 2024
749fbba
Merge pull request #1906 from laws-africa/sort
longhotsummer Jul 16, 2024
b5b36e2
adds _document_table_form; updates court facets
actlikewill Jul 16, 2024
d54de55
fix filtering; don't duplicate form; progress bar
longhotsummer Jul 16, 2024
a9a96c3
unify document listing layouts; search beside doc count
longhotsummer Jul 16, 2024
765405c
intcomma for doc counts
longhotsummer Jul 16, 2024
c278969
default sorting
longhotsummer Jul 16, 2024
8c4a8d5
fix sorting bug
longhotsummer Jul 16, 2024
0cb5a7a
Merge pull request #1907 from laws-africa/tweaks
longhotsummer Jul 16, 2024
dbe13b6
make help_link easier to set
longhotsummer Jul 16, 2024
acfaa66
adds facet clear
actlikewill Jul 16, 2024
c3fdd81
set default sort
longhotsummer Jul 16, 2024
ac648da
spacing on mobile
longhotsummer Jul 16, 2024
a9c4c14
make offcanvas filters work
longhotsummer Jul 16, 2024
f8f4881
move filters back and forth
longhotsummer Jul 16, 2024
6790de6
adds support for taxonomies
actlikewill Jul 16, 2024
3f6b421
Merge pull request #1908 from laws-africa/offcanvas
longhotsummer Jul 16, 2024
114c767
fixes heading template
actlikewill Jul 16, 2024
eafdb8b
adds distinct for judges and attorneys filters
actlikewill Jul 16, 2024
f487acb
lawlibrary legislation notice
longhotsummer Jul 16, 2024
5120661
prefetch labels
longhotsummer Jul 16, 2024
162445d
simplify prefetch for legislation
longhotsummer Jul 16, 2024
d055402
uses get_queryset method to calculate facets
actlikewill Jul 16, 2024
6917286
adds get variant queryset
actlikewill Jul 16, 2024
a07a22a
adds repealed legislation warning
actlikewill Jul 17, 2024
97cd21e
prefetch labels
longhotsummer Jul 17, 2024
19eabff
fix ES-based listing views
longhotsummer Jul 17, 2024
81dd89d
extracted strings for translation
longhotsummer Jul 17, 2024
ccd6c7b
adds doc index facets; clear all button
actlikewill Jul 17, 2024
3a6b266
hide filter controls in pocketlaw
longhotsummer Jul 17, 2024
5463a38
guard against htmx race conditions
longhotsummer Jul 18, 2024
1b11d49
translation
longhotsummer Jul 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions africanlii/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
class ESDocumentFilterForm(BaseDocumentFilterForm):
"""Form for filtering documents in Elasticsearch. Only applies a subset of filters."""

def filter_queryset(self, search, exclude=None):
def filter_queryset(self, search, exclude=None, filter_q=False):
alphabet = self.cleaned_data.get("alphabet")
jurisdictions = self.params.getlist("jurisdictions")
years = self.params.getlist("years")
q = self.params.get("q")
if not isinstance(exclude, list):
exclude = [exclude]

# Order by title then date descending
search = search.sort("title_keyword", "-date")
search = self.order_queryset(search, exclude)

if alphabet and "alphabet" not in exclude:
search = search.filter(
Expand All @@ -25,8 +25,20 @@ def filter_queryset(self, search, exclude=None):
if years and "years" not in exclude:
search = search.filter("terms", year=years)

if filter_q and q and "q" not in exclude:
search = search.query("match", title=q)

return search

def order_queryset(self, queryset, exclude=None):
sort = self.cleaned_data.get("sort") or "-date"
if sort == "title":
sort = "title_keyword"
elif sort == "-title":
sort = "-title_keyword"
queryset = queryset.sort(sort, "title_keyword")
return queryset

def filter_faceted_search(self, search):
"""Add filters to a faceted search object, which is a bit different to adding them to the normal search
object."""
Expand Down
60 changes: 28 additions & 32 deletions africanlii/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-31 08:54+0300\n"
"POT-Creation-Date: 2024-07-17 09:40+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -134,7 +134,7 @@ msgid "For more information, visit the <a href=\"https://au.int/\" target=\"_bla
msgstr ""

#: templates/africanlii/au_detail_page.html:39
#: templates/africanlii/au_organ_detail.html:12
#: templates/africanlii/au_organ_detail.html:11
#: templates/peachjam/_header.html:78 templates/peachjam/home.html:64
msgid "African Union Organs"
msgstr ""
Expand All @@ -158,28 +158,24 @@ msgid "Member States"
msgstr ""

#: templates/africanlii/au_institution_detail.html:9
#: templates/africanlii/au_organ_detail.html:9
#: templates/africanlii/au_organ_detail.html:8
#: templates/africanlii/member_state_detail.html:9
#: templates/africanlii/regional_economic_community_detail.html:9
msgid "African Union"
msgstr ""

#: templates/africanlii/au_institution_detail.html:37
#: templates/africanlii/au_organ_detail.html:37
#: templates/africanlii/member_state_detail.html:38
#: templates/africanlii/regional_economic_community_detail.html:38
msgid "No documents found."
msgstr ""

#: templates/africanlii/doc_index_detail.html:8
#: templates/africanlii/doc_index_first_level.html:7
#: templates/africanlii/doc_indexes.html:4
#: templates/africanlii/doc_indexes.html:8
msgid "Indexes"
msgstr ""

#: templates/africanlii/member_state_detail.html:38
msgid "No documents found."
msgstr ""

#: templates/peachjam/_footer.html:5 templates/peachjam/_header.html:123
#: templates/peachjam/about.html:4
msgid "About"
msgstr ""

Expand All @@ -203,11 +199,11 @@ msgstr ""
msgid "With support from"
msgstr ""

#: templates/peachjam/_footer.html:44 templates/peachjam/_footer.html:138
#: templates/peachjam/_footer.html:44 templates/peachjam/_footer.html:144
msgid "European Union"
msgstr ""

#: templates/peachjam/_footer.html:49 templates/peachjam/_footer.html:151
#: templates/peachjam/_footer.html:49 templates/peachjam/_footer.html:157
#: templates/peachjam/_header.html:19
msgid "Open Law Africa"
msgstr ""
Expand All @@ -216,7 +212,7 @@ msgstr ""
msgid "Other African Legal Information Institutions"
msgstr ""

#: templates/peachjam/_footer.html:118
#: templates/peachjam/_footer.html:124
msgid "University of Cape Town"
msgstr ""

Expand Down Expand Up @@ -289,63 +285,63 @@ msgstr ""
msgid "Help"
msgstr ""

#: templates/peachjam/about.html:9
#: templates/peachjam/about.html:4
msgid "About the platform"
msgstr ""

#: templates/peachjam/about.html:11
#: templates/peachjam/about.html:8
msgid "This Pan-African platform serves as an information clearinghouse on all aspects of the African Governance Architecture (AGA) agenda, including charters, protocols, communications, relevant legal decisions, policy, implementation, monitoring, and related material. The overall objective is to build effective collaboration between African citizens and civil society organisations on the one hand, and AGA members on the other, to strengthen implementation of the AGA platform’s agenda with respect to democracy, governance, and human rights. Our specific goals are to:"
msgstr ""

#: templates/peachjam/about.html:22
#: templates/peachjam/about.html:19
msgid "Increase overall awareness of the AGA agenda and popular perceptions about democracy, governance and human rights among civil society organisations (CSOs) and AGA members"
msgstr ""

#: templates/peachjam/about.html:28
#: templates/peachjam/about.html:25
msgid "Supply complete, accurate and re-usable AGA information to allow AGA and CSOs to work towards shared goals"
msgstr ""

#: templates/peachjam/about.html:33
#: templates/peachjam/about.html:30
msgid "Capacitate civil society on all levels to access, interpret and effectively use AGA information"
msgstr ""

#: templates/peachjam/about.html:38
#: templates/peachjam/about.html:35
msgid "Strengthen monitoring, develop insights, and improve national-level implementation by developing linkages between regional and member-states’ law and policy."
msgstr ""

#: templates/peachjam/about.html:45
#: templates/peachjam/about.html:42
msgid "This platform is developed and maintained jointly by <a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> and <a href=\"https://laws.africa/\" target=\"_blank\">Laws.Africa</a> with funds from the European Union, the Indigo Trust and the Sigrid Rausing Trust. The initial phase of the project runs from 2021 to 2024."
msgstr ""

#: templates/peachjam/about.html:51
#: templates/peachjam/about.html:48
msgid "Platform developers"
msgstr ""

#: templates/peachjam/about.html:53
#: templates/peachjam/about.html:50
msgid "<a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> is a programme of the Democratic Governance and Rights Unit at the Department of Public Law, University of Cape Town. <a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> helps governments, academia and non-profit organisations publish the law of African countries for sustainable open access. <a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> hosts curated collections on various subjects of African law, such as human rights, the environment, commercial law and finance."
msgstr ""

#: templates/peachjam/about.html:61
#: templates/peachjam/about.html:58
msgid "<a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> convenes a network of 16 African LIIs - a collaborative group of governments, organizations, and individuals in Africa, dedicated to free access to law on our continent."
msgstr ""

#: templates/peachjam/about.html:67
#: templates/peachjam/about.html:64
msgid "<a href=\"https://laws.africa/\" target=\"_blank\">Laws.Africa</a> helps African governments to sustainably digitise their legal information for public use, through open law software, capacity-building, training, partnerships and support. <a href=\"https://laws.africa/\" target=\"_blank\">Laws.Africa’s</a> Open Law Technology solutions lower the cost of digitisation, archival and publication of primary legal information, and create opportunities for rich interactivity, advanced research and justice sector innovation."
msgstr ""

#: templates/peachjam/about.html:75
#: templates/peachjam/about.html:72
msgid "<a href=\"https://africanlii.org/\" target=\"_blank\">AfricanLII</a> and <a href=\"https://laws.africa/\" target=\"_blank\">Laws.Africa</a> collaborate in unlocking the value of African digital legal information in support of the rule of law, access to justice, and innovation."
msgstr ""

#: templates/peachjam/about.html:80
#: templates/peachjam/about.html:77
msgid "Find out more"
msgstr ""

#: templates/peachjam/about.html:82
#: templates/peachjam/about.html:79
msgid "Visit <a href=\"https://openlawafrica.org/\" target=\"_blank\">openlawafrica.org</a> or contact us on <a href=\"mailto:[email protected]\">[email protected]</a> for more information."
msgstr ""

#: templates/peachjam/about.html:92
#: templates/peachjam/about.html:86
msgid "Our partners"
msgstr ""

Expand Down Expand Up @@ -443,15 +439,15 @@ msgstr ""
msgid "Search African legal information"
msgstr ""

#: templates/peachjam/home.html:188
#: templates/peachjam/home.html:190
msgid "Latest Commentary"
msgstr ""

#: templates/peachjam/home.html:191
#: templates/peachjam/home.html:193
msgid "View more commentary"
msgstr ""

#: templates/peachjam/home.html:197
#: templates/peachjam/home.html:199
msgid "Collections"
msgstr ""

Expand Down
Loading
Loading