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

Responsible document table and improved legislation listing #1834

Merged
merged 13 commits into from
Jun 3, 2024
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
Loading