Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into gazettes
Browse files Browse the repository at this point in the history
  • Loading branch information
longhotsummer committed Aug 6, 2024
2 parents 0336204 + 6b11282 commit 8e3fdce
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 13 deletions.
12 changes: 9 additions & 3 deletions peachjam/js/components/FindDocuments/AdvancedSearchFields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,18 @@ export default {
fields: [{
field: 'all',
label: self.$t('Any field')
},{
}, {
field: 'title',
label: self.$t('Title')
}, {
field: 'judges',
label: self.$t('Judges')
field: 'citation',
label: self.$t('Citation')
}, {
field: 'case_number',
label: self.$t('Case number')
}, {
field: 'case_name',
label: self.$t('Case parties')
}, {
field: 'case_summary',
label: self.$t('Case summary')
Expand Down
17 changes: 16 additions & 1 deletion peachjam/js/components/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,23 @@ export class CopyToClipboard {

async copy () {
try {
const text = this.root.dataset.value;
const html = this.root.dataset.valueHtml;

if (navigator && navigator.clipboard) {
await navigator.clipboard.writeText(this.root.dataset.value || '');
const items: Record<string, Blob> = {};

if (text) {
const type = 'text/plain';
items[type] = new Blob([text], { type });
}

if (html) {
const type = 'text/html';
items[type] = new Blob([html], { type });
}

await navigator.clipboard.write([new ClipboardItem(items)]);

this.root.innerText = this.root.dataset.confirmation || 'Copied!';
setTimeout(() => {
Expand Down
1 change: 1 addition & 0 deletions peachjam/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"allauth.account.middleware.AccountMiddleware",
"django.middleware.cache.FetchFromCacheMiddleware",
"django_htmx.middleware.HtmxMiddleware",
"django.contrib.sites.middleware.CurrentSiteMiddleware",
]

ROOT_URLCONF = "peachjam.urls"
Expand Down
2 changes: 1 addition & 1 deletion peachjam/static/js/app-prod.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion peachjam/static/js/app-prod.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion peachjam/static/js/pdf.worker-prod.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions peachjam/templates/peachjam/_document_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="align-items-center"
role="button"
data-sort="{% if form.sort.value == "title" %}-title{% else %}title{% endif %}">
{% trans 'Title' %}
{{ doc_table_title_label|default_if_none:"Title" }}
<i class="bi ms-2 {% if form.sort.value == "title" %}bi-sort-down{% endif %} {% if form.sort.value == "-title" %}bi-sort-up{% endif %}"></i>
</div>
</th>
Expand All @@ -29,7 +29,7 @@
<div class="align-items-center"
role="button"
data-sort="{% if form.sort.value == "date" %}-date{% else %}date{% endif %}">
{% trans 'Date' %}
{{ doc_table_date_label|default_if_none:"Date" }}
<i class="bi ms-2 {% if form.sort.value == "-date" %}bi-sort-down{% endif %} {% if form.sort.value == "date" %}bi-sort-up{% endif %}"></i>
</div>
</th>
Expand Down
4 changes: 3 additions & 1 deletion peachjam/templates/peachjam/_quick_search.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<form action="{% url 'search:search' %}" method="get" class="d-flex">
{% load i18n %}
<form action="{% url 'search:search' %}" method="get" class="d-flex mb-1">
<input type="text"
class="form-control flex-grow-1"
name="q"
Expand All @@ -13,3 +14,4 @@
{% if locality %}<input type="hidden" name="locality" value="{{ locality }}"/>{% endif %}
{% if doc_type %}<input type="hidden" name="doc_type" value="{{ doc_type }}"/>{% endif %}
</form>
<a href="{% url 'search:search' %}?show-advanced-tab=1&doc_type={{ doc_type }}">{% trans "Advanced search" %}</a>
3 changes: 2 additions & 1 deletion peachjam/templates/peachjam/judgment_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
class="btn btn-outline-secondary btn-xs ms-2"
title="{% trans "Copy to clipboard" %}"
data-component="CopyToClipboard"
data-value="{{ document.mnc }}"
data-value='{{ document.mnc }}'
data-value-html='<a href="https://{{ request.site.domain }}{{ document.get_absolute_url }}">{{ document.mnc }}</a>'
data-confirmation="{% trans "Copied!" %}">
{% trans "Copy" %}
</button>
Expand Down
6 changes: 4 additions & 2 deletions peachjam/templates/peachjam/layouts/document_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ <h1>{{ document.title }}</h1>
class="btn btn-outline-secondary btn-xs ms-2"
title="{% trans "Copy to clipboard" %}"
data-component="CopyToClipboard"
data-value="{{ document.citation }}"
data-value='{{ document.citation }}'
data-value-html='<a href="https://{{ request.site.domain }}{{ document.get_absolute_url }}">{{ document.citation }}</a>'
data-confirmation="{% trans "Copied!" %}">
{% trans "Copy" %}
</button>
Expand All @@ -210,7 +211,8 @@ <h1>{{ document.title }}</h1>
class="btn btn-outline-secondary btn-xs ms-2"
title="{% trans "Copy to clipboard" %}"
data-component="CopyToClipboard"
data-value="{{ alternative_name.title }}"
data-value='{{ alternative_name.title }}'
data-value-html='<a href="https://{{ request.site.domain }}{{ document.get_absolute_url }}">{{ alternative_name.title }}</a>'
data-confirmation="{% trans "Copied!" %}">
{% trans "Copy" %}
</button>
Expand Down
2 changes: 2 additions & 0 deletions peachjam/views/courts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def get_context_data(self, **kwargs):
context["doc_type"] = "Judgment"
context["page_title"] = self.page_title()
context["doc_table_show_jurisdiction"] = False
context["doc_table_title_label"] = _("Citation")
context["doc_table_date_label"] = _("Judgment date")
context["doc_count_noun"] = _("judgment")
context["doc_count_noun_plural"] = _("judgments")

Expand Down
2 changes: 2 additions & 0 deletions peachjam/views/generic_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def get_context_data(self, **kwargs):
if context["paginator"]
else context["object_list"].count()
)
context["doc_table_title_label"] = _("Title")
context["doc_table_date_label"] = _("Date")

return context

Expand Down
2 changes: 2 additions & 0 deletions peachjam_search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ class DocumentSearchViewSet(BaseDocumentViewSet):
"content": None,
"court": None,
"alternative_names": {"boost": 4},
"case_number": None,
"case_name": None,
}

faceted_search_fields = {
Expand Down

0 comments on commit 8e3fdce

Please sign in to comment.