From 05004e31a782a32726fb60d65a5027eac996650d Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Fri, 31 May 2024 16:03:28 +0200 Subject: [PATCH 01/13] document table and updated legislation listing --- .../components/LegislationTable/TableRow.vue | 42 +++ .../js/components/LegislationTable/index.vue | 304 ++++++++---------- .../static/stylesheets/components/_index.scss | 1 + .../stylesheets/components/_tables.scss | 75 +++++ 4 files changed, 257 insertions(+), 165 deletions(-) create mode 100644 peachjam/js/components/LegislationTable/TableRow.vue create mode 100644 peachjam/static/stylesheets/components/_tables.scss diff --git a/peachjam/js/components/LegislationTable/TableRow.vue b/peachjam/js/components/LegislationTable/TableRow.vue new file mode 100644 index 000000000..864665dce --- /dev/null +++ b/peachjam/js/components/LegislationTable/TableRow.vue @@ -0,0 +1,42 @@ + + + diff --git a/peachjam/js/components/LegislationTable/index.vue b/peachjam/js/components/LegislationTable/index.vue index 39e4d7164..4d2219641 100644 --- a/peachjam/js/components/LegislationTable/index.vue +++ b/peachjam/js/components/LegislationTable/index.vue @@ -43,155 +43,115 @@ Filters -
-
- -
-
-
-
- {{ filteredData.length }} of {{ tableData.length }} documents -
-
-
-
-
-
-
- {{ $t('Title') }} - - -
-
- {{ $t('Numbered title') }} - - -
-
- {{ $t('Date') }} - - -
+
+ +
+
+ {{ filteredData.length }} of {{ tableData.length }} documents +
+
+
+
+
+
+ {{ $t('Title') }} + +
-
- -
- {{ $t('No legislation found.') }} - - {{ $t('Try searching instead') }} - .
+
+
+ {{ $t('No legislation found.') }} + + {{ $t('Try searching instead') }} + .
+
{{ $t('Years') }} @@ -203,12 +163,14 @@ - - diff --git a/peachjam/static/stylesheets/components/_tables.scss b/peachjam/static/stylesheets/components/_tables.scss index 3d342bfa0..b07d44cb5 100644 --- a/peachjam/static/stylesheets/components/_tables.scss +++ b/peachjam/static/stylesheets/components/_tables.scss @@ -1,49 +1,43 @@ .doc-table { .doc-table-row { display: grid; - grid-template-columns: repeat(12, 1fr); - gap: 0rem 1rem; + grid-template-columns: 15px repeat(12, 1fr); + gap: 0rem 0.5rem; + padding: 0.5rem 0; border-bottom-style: solid; border-bottom-color: var(--bs-border-color); border-bottom-width: var(--bs-border-width); - &.has-children .bi-caret-down-fill { display: none; } - &.has-children.expanded { - .bi-caret-right-fill { display: none; } - .bi-caret-down-fill { display: inline; } + &.has-children .bi-caret-down-fill { + display: none; } - } - .doc-table-cell { - padding: 0.5rem; + &.has-children.expanded { + .bi-caret-right-fill { + display: none; + } + + .bi-caret-down-fill { + display: inline; + } + } } - .doc-table-header { + .doc-table-head { font-weight: bold; + border-bottom-color: $primary; } .cell-group { - grid-column: span 3; + grid-column: span 12; font-weight: bold; - margin-left: 20px; - } - - .cell-title { - display: flex; - - .indent { - flex: 0 0 20px; - } - - .title { - flex-grow: 1; - } } .doc-table-children { - .cell-title .title { - padding-left: 20px; + .doc-table-row { + // extra initial padding for child rows + grid-template-columns: 30px repeat(12, 1fr); } } @@ -61,15 +55,30 @@ .cell-date { grid-column: span 2; } - } -} - -@include media-breakpoint-up(md) { - .doc-table { - //grid-template-columns: repeat(3, 1fr); - - .doc-table-row { + @include media-breakpoint-down(md) { + .doc-table-head { + .cell-subtitle, + .cell-date { + display: none; + } + } + + .cell-toggle { + grid-row: span 2; + } + + .cell-title { + grid-column: span 12; + } + + .cell-subtitle { + grid-column: span 10; + } + + .cell-date { + grid-column: span 2; + } } } } From f76dd941ff4e3e8ebc45f45844a8cc6427420297 Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Fri, 31 May 2024 17:08:09 +0200 Subject: [PATCH 03/13] simpler sorting --- .../js/components/LegislationTable/index.vue | 104 +++++++----------- 1 file changed, 37 insertions(+), 67 deletions(-) diff --git a/peachjam/js/components/LegislationTable/index.vue b/peachjam/js/components/LegislationTable/index.vue index 3edf3002b..1d8044cd4 100644 --- a/peachjam/js/components/LegislationTable/index.vue +++ b/peachjam/js/components/LegislationTable/index.vue @@ -43,13 +43,25 @@ Filters
-
- +
+
+ +
+
+ +
{{ filteredData.length }} of {{ tableData.length }} documents @@ -64,14 +76,8 @@ @click="updateSort('title')" > {{ $t('Title') }} - - + +
@@ -80,14 +86,8 @@ @click="updateSort('citation')" > {{ $t('Numbered title') }} - - + +
@@ -96,14 +96,8 @@ @click="updateSort('year')" > {{ $t('Year') }} - - + +
@@ -183,17 +177,13 @@ export default { lockAccordion: false, q: '', windowWith: window.innerWidth, - sortableFields: { - title: 'asc', - citation: '', - year: '' - } + sort: 'title' }), watch: { q () { this.filterData(); }, - sortableFields () { + sort () { this.filterData(); }, facets () { @@ -204,7 +194,6 @@ export default { beforeUnmount () { window.removeEventListener('resize', this.setWindowWidth); }, - mounted () { this.offCanvasFacets = new window.bootstrap.Offcanvas( this.$refs['mobile-legislation-facets-ref'] @@ -291,22 +280,11 @@ export default { ]; }, updateSort (field) { - let newSortValue; - if (this.sortableFields[field] === '') { - newSortValue = 'asc'; - } else if (this.sortableFields[field] === 'asc') { - newSortValue = 'desc'; - } else if (this.sortableFields[field] === 'desc') { - newSortValue = 'asc'; + if (this.sort === field) { + this.sort = `-${field}`; + } else { + this.sort = field; } - this.sortableFields = { - ...{ - title: '', - citation: '', - year: '' - }, - [field]: newSortValue - }; }, filterData () { let data = [...this.tableData]; @@ -342,20 +320,12 @@ export default { }); }); - let sortKey = null; - Object.keys(this.sortableFields).forEach((key) => { - if (this.sortableFields[key]) { - sortKey = key; - data.sort((a, b) => { - const fa = a[key] ? a[key].toLowerCase() : ''; - const fb = b[key] ? b[key].toLowerCase() : ''; - if (this.sortableFields[key] === 'asc') { - return fa.localeCompare(fb); - } else if (this.sortableFields[key] === 'desc') { - return fb.localeCompare(fa); - } - }); - } + const sortAsc = this.sort[0] !== '-'; + const sortKey = sortAsc ? this.sort : this.sort.substring(1); + data.sort((a, b) => { + const fa = a[sortKey] ? a[sortKey].toLowerCase() : ''; + const fb = b[sortKey] ? b[sortKey].toLowerCase() : ''; + return fa.localeCompare(fb) * (sortAsc ? 1 : -1); }); this.filteredData = data; From a9e969beb80099c212f1a4fcd7a031bebf54cc7a Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Fri, 31 May 2024 17:09:29 +0200 Subject: [PATCH 04/13] remove numbered title heading, and sorting this is just confusing --- peachjam/js/components/LegislationTable/index.vue | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/peachjam/js/components/LegislationTable/index.vue b/peachjam/js/components/LegislationTable/index.vue index 1d8044cd4..5b6ce31ce 100644 --- a/peachjam/js/components/LegislationTable/index.vue +++ b/peachjam/js/components/LegislationTable/index.vue @@ -58,8 +58,6 @@ - -
@@ -81,14 +79,6 @@
-
- {{ $t('Numbered title') }} - - -
Date: Fri, 31 May 2024 17:12:40 +0200 Subject: [PATCH 05/13] sort year newest first by default --- peachjam/js/components/LegislationTable/index.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/peachjam/js/components/LegislationTable/index.vue b/peachjam/js/components/LegislationTable/index.vue index 5b6ce31ce..7d2dc03a1 100644 --- a/peachjam/js/components/LegislationTable/index.vue +++ b/peachjam/js/components/LegislationTable/index.vue @@ -56,8 +56,8 @@
@@ -66,7 +66,7 @@
-
+
-
-
+
{ const fa = a[sortKey] ? a[sortKey].toLowerCase() : ''; const fb = b[sortKey] ? b[sortKey].toLowerCase() : ''; - return fa.localeCompare(fb) * (sortAsc ? 1 : -1); + // year is the exception that we want to sort desc by default + return fa.localeCompare(fb) * (sortAsc ? 1 : -1) * (sortKey === 'year' ? -1 : 1); }); this.filteredData = data; From e70baa3d3e9d8eac5ce28e32f4b3e08ee02e4812 Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Fri, 31 May 2024 17:16:52 +0200 Subject: [PATCH 06/13] subleg padding and sorting --- .../js/components/LegislationTable/index.vue | 18 +++++++++++------ .../stylesheets/components/_tables.scss | 20 +++++++++++++++---- peachjam_api/serializers.py | 9 +++++++-- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/peachjam/js/components/LegislationTable/index.vue b/peachjam/js/components/LegislationTable/index.vue index 7d2dc03a1..68e016349 100644 --- a/peachjam/js/components/LegislationTable/index.vue +++ b/peachjam/js/components/LegislationTable/index.vue @@ -311,12 +311,10 @@ export default { const sortAsc = this.sort[0] !== '-'; const sortKey = sortAsc ? this.sort : this.sort.substring(1); - data.sort((a, b) => { - const fa = a[sortKey] ? a[sortKey].toLowerCase() : ''; - const fb = b[sortKey] ? b[sortKey].toLowerCase() : ''; - // year is the exception that we want to sort desc by default - return fa.localeCompare(fb) * (sortAsc ? 1 : -1) * (sortKey === 'year' ? -1 : 1); - }); + this.sortRows(data, sortKey, sortAsc); + for (const item of data) { + this.sortRows(item.children, sortKey, sortAsc); + } this.filteredData = data; this.rows = []; @@ -344,6 +342,14 @@ export default { } this.rows.push(record); }); + }, + sortRows (rows, sortKey, sortAsc) { + rows.sort((a, b) => { + const fa = a[sortKey] ? a[sortKey].toLowerCase() : ''; + const fb = b[sortKey] ? b[sortKey].toLowerCase() : ''; + // year is the exception that we want to sort desc by default + return fa.localeCompare(fb) * (sortAsc ? 1 : -1) * (sortKey === 'year' ? -1 : 1); + }); } } }; diff --git a/peachjam/static/stylesheets/components/_tables.scss b/peachjam/static/stylesheets/components/_tables.scss index b07d44cb5..763bfcb18 100644 --- a/peachjam/static/stylesheets/components/_tables.scss +++ b/peachjam/static/stylesheets/components/_tables.scss @@ -35,9 +35,8 @@ } .doc-table-children { - .doc-table-row { - // extra initial padding for child rows - grid-template-columns: 30px repeat(12, 1fr); + .cell-title { + padding-left: 20px; } } @@ -55,8 +54,21 @@ .cell-date { grid-column: span 2; } + } + + @include media-breakpoint-down(md) { + .doc-table-children { + .cell-title { + padding-left: 0px; + } + + .doc-table-row { + // extra initial padding for child rows + grid-template-columns: 30px repeat(12, 1fr); + } + } - @include media-breakpoint-down(md) { + &.doc-table-title-subtitle-date { .doc-table-head { .cell-subtitle, .cell-date { diff --git a/peachjam_api/serializers.py b/peachjam_api/serializers.py index e600885c1..15d237384 100644 --- a/peachjam_api/serializers.py +++ b/peachjam_api/serializers.py @@ -74,9 +74,15 @@ class Meta: class ChildLegislationSerializer(serializers.ModelSerializer): + year = serializers.SerializerMethodField("get_year") + class Meta: model = Legislation - fields = ("title", "citation", "work_frbr_uri", "repealed", "date") + fields = ("title", "citation", "work_frbr_uri", "repealed", "year") + + def get_year(self, instance): + """Use the FRBR work uri, rather than the document year.""" + return instance.frbr_uri_date.split("-")[0] class LegislationSerializer(serializers.ModelSerializer): @@ -91,7 +97,6 @@ class Meta: "title", "children", "citation", - "date", "work_frbr_uri", "repealed", "year", From da585a3249d49f2851ed6b88ef5ead430aac2f8d Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Fri, 31 May 2024 20:06:24 +0200 Subject: [PATCH 07/13] layout for legis without citation --- lawlibrary/views/legislation.py | 2 +- liiweb/templates/liiweb/legislation_list.html | 2 +- liiweb/views/legislation.py | 1 + open_by_laws/views/by_laws.py | 2 +- .../components/LegislationTable/TableRow.vue | 4 +- .../js/components/LegislationTable/index.vue | 14 ++- .../stylesheets/components/_tables.scss | 91 ++++++++++++++----- 7 files changed, 85 insertions(+), 31 deletions(-) diff --git a/lawlibrary/views/legislation.py b/lawlibrary/views/legislation.py index b9e8bc3a0..01257392c 100644 --- a/lawlibrary/views/legislation.py +++ b/lawlibrary/views/legislation.py @@ -54,6 +54,6 @@ def get_context_data(self, **kwargs): ) self.navbar_link = "legislation/municipal" context["breadcrumb_link"] = reverse("municipal_legislation") - context["legislation_list_show_dates"] = True + context["doc_table_citations"] = False return context diff --git a/liiweb/templates/liiweb/legislation_list.html b/liiweb/templates/liiweb/legislation_list.html index b8221763f..96db98faa 100644 --- a/liiweb/templates/liiweb/legislation_list.html +++ b/liiweb/templates/liiweb/legislation_list.html @@ -60,7 +60,7 @@

{% trans 'Legislation' %}

{% trans 'You are viewing repealed legislation which is no longer in force.' %}
{% endif %}
+ {% if not doc_table_citations %}data-hide-citations="true"{% endif %}> {% comment %} This ensures that peachjam has links to scrape. This content is replaced when the javacript LegislationTable component runs. diff --git a/liiweb/views/legislation.py b/liiweb/views/legislation.py index 09b527fa0..8357c1fe4 100644 --- a/liiweb/views/legislation.py +++ b/liiweb/views/legislation.py @@ -14,6 +14,7 @@ class LegislationListView(TemplateView): variant = "current" navbar_link = "legislation" model = Legislation + extra_context = {"doc_table_citations": True} def get_queryset(self): qs = ( diff --git a/open_by_laws/views/by_laws.py b/open_by_laws/views/by_laws.py index ab729443b..b16346538 100644 --- a/open_by_laws/views/by_laws.py +++ b/open_by_laws/views/by_laws.py @@ -3,4 +3,4 @@ class MunicipalByLawsView(LocalityLegislationListView): template_name = "open_by_laws/municipal_by_laws_list.html" - extra_context = {"legislation_list_show_dates": True} + extra_context = {"doc_table_citations": False} diff --git a/peachjam/js/components/LegislationTable/TableRow.vue b/peachjam/js/components/LegislationTable/TableRow.vue index 954cb1b63..deca7568f 100644 --- a/peachjam/js/components/LegislationTable/TableRow.vue +++ b/peachjam/js/components/LegislationTable/TableRow.vue @@ -23,7 +23,7 @@ :title="$t('Multiple languages available')" />
-
+
{{ row.citation }}
@@ -35,7 +35,7 @@ diff --git a/peachjam/js/components/LegislationTable/index.vue b/peachjam/js/components/LegislationTable/index.vue index 68e016349..b24401462 100644 --- a/peachjam/js/components/LegislationTable/index.vue +++ b/peachjam/js/components/LegislationTable/index.vue @@ -64,7 +64,7 @@
{{ filteredData.length }} of {{ tableData.length }} documents
-
+
@@ -78,7 +78,7 @@
-
+
@@ -156,7 +158,7 @@ export default { FilterFacets, TableRow }, - props: ['showDates'], + props: ['hideCitations'], data: () => ({ offCanvasFacets: null, facets: [], @@ -195,7 +197,11 @@ export default { this.filterData(); this.setFacets(); }, - + computed: { + docTableClass () { + return this.hideCitations ? 'doc-table-toggle-title-date' : 'doc-table-toggle-title-citation-date'; + } + }, methods: { toggleChildren (index) { const row = document.getElementById(`row-${index}`); diff --git a/peachjam/static/stylesheets/components/_tables.scss b/peachjam/static/stylesheets/components/_tables.scss index 763bfcb18..fed9ed743 100644 --- a/peachjam/static/stylesheets/components/_tables.scss +++ b/peachjam/static/stylesheets/components/_tables.scss @@ -1,7 +1,7 @@ .doc-table { .doc-table-row { display: grid; - grid-template-columns: 15px repeat(12, 1fr); + grid-template-columns: repeat(12, 1fr); gap: 0rem 0.5rem; padding: 0.5rem 0; @@ -40,54 +40,101 @@ } } + @include media-breakpoint-down(md) { + .doc-table-head { + .cell-citation, + .cell-date { + display: none; + } + } + + .doc-table-children { + .cell-title { + padding-left: 0px; + } + + .doc-table-row { + // extra initial padding for child rows + grid-template-columns: 30px repeat(12, 1fr); + } + } + } + // sizing for different groups of columns - &.doc-table-title-subtitle-date { + // toggle, title, citation, date + &.doc-table-toggle-title-citation-date { + .doc-table-row { + // extra space for toggle + grid-template-columns: 15px repeat(12, 1fr); + } .cell-title { grid-column: span 7; } - - .cell-subtitle { + .cell-citation { grid-column: span 3; } - .cell-date { grid-column: span 2; } - } - @include media-breakpoint-down(md) { - .doc-table-children { - .cell-title { - padding-left: 0px; + @include media-breakpoint-down(md) { + .doc-table-children { + .doc-table-row { + // extra space for toggle + grid-template-columns: 30px repeat(12, 1fr); + } } - .doc-table-row { - // extra initial padding for child rows - grid-template-columns: 30px repeat(12, 1fr); + .cell-toggle { + grid-row: span 2; + } + .cell-title { + grid-column: span 12; + } + .cell-citation { + grid-column: span 10; + } + .cell-date { + grid-column: span 2; } - } - &.doc-table-title-subtitle-date { .doc-table-head { - .cell-subtitle, + .cell-citation, .cell-date { display: none; } } + } + } + + // toggle, title, date + &.doc-table-toggle-title-date { + .doc-table-row { + // extra space for toggle + grid-template-columns: 15px repeat(12, 1fr); + } + .cell-title { + grid-column: span 10; + } + .cell-date { + grid-column: span 2; + } + + @include media-breakpoint-down(md) { + .doc-table-children { + .doc-table-row { + // extra space for toggle + grid-template-columns: 30px repeat(12, 1fr); + } + } .cell-toggle { grid-row: span 2; } - .cell-title { - grid-column: span 12; - } - - .cell-subtitle { grid-column: span 10; } - .cell-date { grid-column: span 2; } From 0207e628aad994b5479edbb77fc45029a2eeff3b Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Fri, 31 May 2024 20:46:06 +0200 Subject: [PATCH 08/13] use doc table for judgment table --- .../stylesheets/components/_tables.scss | 25 ++++++++++++ .../peachjam/_grouped_judgments_table.html | 34 ++++++++--------- .../templates/peachjam/_judgment_table.html | 38 ++++++++----------- 3 files changed, 57 insertions(+), 40 deletions(-) diff --git a/peachjam/static/stylesheets/components/_tables.scss b/peachjam/static/stylesheets/components/_tables.scss index fed9ed743..c8504c662 100644 --- a/peachjam/static/stylesheets/components/_tables.scss +++ b/peachjam/static/stylesheets/components/_tables.scss @@ -1,4 +1,6 @@ .doc-table { + margin-bottom: $spacer; + .doc-table-row { display: grid; grid-template-columns: repeat(12, 1fr); @@ -40,6 +42,10 @@ } } + .cell-date { + text-align: right; + } + @include media-breakpoint-down(md) { .doc-table-head { .cell-citation, @@ -140,4 +146,23 @@ } } } + + // title, date + &.doc-table-title-date { + .cell-title { + grid-column: span 10; + } + .cell-date { + grid-column: span 2; + } + + @include media-breakpoint-down(md) { + .cell-title { + grid-column: span 12; + } + .cell-date { + grid-column: span 12; + } + } + } } diff --git a/peachjam/templates/peachjam/_grouped_judgments_table.html b/peachjam/templates/peachjam/_grouped_judgments_table.html index eefdabed1..9ab6d43c2 100644 --- a/peachjam/templates/peachjam/_grouped_judgments_table.html +++ b/peachjam/templates/peachjam/_grouped_judgments_table.html @@ -1,21 +1,19 @@ {% extends 'peachjam/_judgment_table.html' %} {% block table-body %} - - {% for item in grouped_documents %} - {% if item.judgments %} - - {{ item.key }} - - - {% for judgment in item.judgments %} - - {{ judgment.title }} - {% include 'peachjam/_labels.html' with labels=judgment.labels.all %} - - {{ judgment.date }} - - {% endfor %} - {% endif %} - {% endfor %} - + {% for item in grouped_documents %} + {% if item.judgments %} +
+
{{ item.key }}
+
+ {% for judgment in item.judgments %} +
+
+ {{ judgment.title }} + {% include 'peachjam/_labels.html' with labels=judgment.labels.all %} +
+
{{ judgment.date }}
+
+ {% endfor %} + {% endif %} + {% endfor %} {% endblock %} diff --git a/peachjam/templates/peachjam/_judgment_table.html b/peachjam/templates/peachjam/_judgment_table.html index a7c396712..5fe03b599 100644 --- a/peachjam/templates/peachjam/_judgment_table.html +++ b/peachjam/templates/peachjam/_judgment_table.html @@ -1,24 +1,18 @@ {% load i18n %} -
- - - - - - - - {% block table-body %} - - {% for document in documents %} - - - - - {% endfor %} - - {% endblock %} -
{% trans 'Title' %}{% trans 'Date' %}
- {{ document.title }} - {% include 'peachjam/_labels.html' with labels=document.labels.all %} - {{ document.date }}
+
+
+
{% trans 'Title' %}
+
{% trans 'Date' %}
+
+ {% block table-body %} + {% for document in documents %} +
+
+ {{ document.title }} + {% include 'peachjam/_labels.html' with labels=document.labels.all %} +
+
{{ document.date }}
+
+ {% endfor %} + {% endblock %}
From ba86ac0c488aae177175bf55c5fb962e74f698d1 Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Fri, 31 May 2024 20:55:01 +0200 Subject: [PATCH 09/13] legislation labels --- peachjam/js/components/LegislationTable/TableRow.vue | 9 +++++++++ peachjam_api/serializers.py | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/peachjam/js/components/LegislationTable/TableRow.vue b/peachjam/js/components/LegislationTable/TableRow.vue index deca7568f..65e1fcdd5 100644 --- a/peachjam/js/components/LegislationTable/TableRow.vue +++ b/peachjam/js/components/LegislationTable/TableRow.vue @@ -22,6 +22,15 @@ class="bi bi-translate ps-2" :title="$t('Multiple languages available')" /> +
+ + {{ label.name }} + +
{{ row.citation }} diff --git a/peachjam_api/serializers.py b/peachjam_api/serializers.py index 15d237384..79da00136 100644 --- a/peachjam_api/serializers.py +++ b/peachjam_api/serializers.py @@ -73,12 +73,19 @@ class Meta: fields = ("id", "document", "text", "url", "target_id", "target_selectors") +class LabelSerializer(serializers.ModelSerializer): + class Meta: + model = Label + fields = ("name", "level") + + class ChildLegislationSerializer(serializers.ModelSerializer): year = serializers.SerializerMethodField("get_year") + labels = LabelSerializer(many=True, read_only=True) class Meta: model = Legislation - fields = ("title", "citation", "work_frbr_uri", "repealed", "year") + fields = ("title", "citation", "work_frbr_uri", "repealed", "year", "labels") def get_year(self, instance): """Use the FRBR work uri, rather than the document year.""" @@ -90,6 +97,7 @@ class LegislationSerializer(serializers.ModelSerializer): year = serializers.SerializerMethodField("get_year") children = ChildLegislationSerializer(many=True, read_only=True) languages = serializers.SerializerMethodField("get_languages") + labels = LabelSerializer(many=True, read_only=True) class Meta: model = Legislation @@ -102,6 +110,7 @@ class Meta: "year", "taxonomies", "languages", + "labels", ) def get_taxonomies(self, instance): From 45267c7b65f1c785d2c91eaa22e0727ae4a0cf06 Mon Sep 17 00:00:00 2001 From: Greg Kempe Date: Sat, 1 Jun 2024 09:03:34 +0200 Subject: [PATCH 10/13] move to a table-first approach which is more flexible --- .../components/LegislationTable/TableRow.vue | 22 +- .../js/components/LegislationTable/index.vue | 75 +++--- .../stylesheets/components/_tables.scss | 226 ++++++++---------- .../templates/peachjam/_document_table.html | 10 +- .../peachjam/_grouped_judgments_table.html | 16 +- .../templates/peachjam/_judgment_table.html | 34 +-- 6 files changed, 185 insertions(+), 198 deletions(-) diff --git a/peachjam/js/components/LegislationTable/TableRow.vue b/peachjam/js/components/LegislationTable/TableRow.vue index 65e1fcdd5..119be31b0 100644 --- a/peachjam/js/components/LegislationTable/TableRow.vue +++ b/peachjam/js/components/LegislationTable/TableRow.vue @@ -1,10 +1,10 @@