Skip to content

Commit

Permalink
Merge pull request #1834 from laws-africa/legislation-listing
Browse files Browse the repository at this point in the history
Responsible document table and improved legislation listing
  • Loading branch information
longhotsummer authored Jun 3, 2024
2 parents 46e4f2a + 5e7cec9 commit 03db3d0
Show file tree
Hide file tree
Showing 13 changed files with 393 additions and 309 deletions.
2 changes: 1 addition & 1 deletion lawlibrary/views/legislation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion liiweb/templates/liiweb/legislation_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ <h1 class="my-4">{% trans 'Legislation' %}</h1>
<div class="alert alert-danger">{% trans 'You are viewing repealed legislation which is no longer in force.' %}</div>
{% endif %}
<div data-vue-component="LegislationTable"
{% if legislation_list_show_dates %}data-show-dates="true"{% endif %}>
data-initial-sort="{{ legislation_list_sort }}"
{% 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.
Expand Down
1 change: 1 addition & 0 deletions liiweb/views/legislation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class LegislationListView(TemplateView):
variant = "current"
navbar_link = "legislation"
model = Legislation
extra_context = {"doc_table_citations": True, "legislation_list_sort": "title"}

def get_queryset(self):
qs = (
Expand Down
2 changes: 1 addition & 1 deletion open_by_laws/views/by_laws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
50 changes: 50 additions & 0 deletions peachjam/js/components/LegislationTable/TableRow.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<tr
:class="`${row.children && row.children.length ? 'has-children' : ''}`"
role="button"
@click="handleRowClick"
>
<td class="cell-toggle">
<div
v-if="row.children && row.children.length"
class="indent"
role="button"
@click="$emit('toggle')"
>
<i class="bi bi-caret-right-fill" />
<i class="bi bi-caret-down-fill" />
</div>
</td>
<td class="cell-title">
<a :href="`${row.work_frbr_uri}`">{{ row.title }}</a>
<i
v-if="row.languages != null && row.languages.length > 1"
class="bi bi-translate ps-2"
:title="$t('Multiple languages available')"
/>
<div v-if="row.labels.length" class="d-flex align-items-center">
<span
v-for="(label, index) in row.labels"
:key="index"
:class="`badge rounded-pill bg-${label.level}`"
>
{{ label.name }}
</span>
</div>
</td>
<td v-if="!hideCitation" class="cell-citation">
{{ row.citation }}
</td>
<td class="cell-date">
{{ row.year }}
</td>
</tr>
</template>

<script>
export default {
name: 'TableRow',
props: ['row', 'hideCitation'],
emits: ['toggle']
};
</script>
Loading

0 comments on commit 03db3d0

Please sign in to comment.