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

Tweaks #1428

Merged
merged 4 commits into from
Aug 11, 2023
Merged

Tweaks #1428

Show file tree
Hide file tree
Changes from 3 commits
Commits
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
7 changes: 5 additions & 2 deletions peachjam/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def _wrapped_view(request, *args, **kwargs):

def get_language(request):
"""Get language from the request object and return its 3-letter language code."""
language = get_language_from_request(request)
return Language.objects.get(iso_639_1__iexact=language).iso_639_3
if not hasattr(request, "language"):
language = get_language_from_request(request)
# store it on the request object because it won't change
request.language = Language.objects.get(iso_639_1__iexact=language).iso_639_3
return request.language


def pdfjs_to_text(fname):
Expand Down
9 changes: 8 additions & 1 deletion peachjam/templates/peachjam/_judgment_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@
<tr>
<td>
<a href="{{ document.get_absolute_url }}">{{ document.title }}</a>
{% include 'peachjam/_labels.html' with labels=document.labels.all %}
</td>
<td>
{% for bench in document.bench.all %}
{# djlint:off #}
{{ bench.judge.name }}{% if not forloop.last %},{% endif %}
{# djlint:on #}
{% endfor %}
</td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@longhotsummer I thought we removed these because some judgments have many judges which makes the table look a bit odd. Maybe we could limit the list to 3 or 4?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, fair point. It's useful information for users to have, particularly those who know the judges.

Let's think it through in more detail, because a long list on mobile is particularly bad. Maybe we can do something like the first 3/4 and have "... and 3 more" or something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. We'll need a better way of displaying long lists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this change based on feedback from the team that the judges aren't actually useful in the listing.

<td>{{ document.judges_string }}</td>
<td style="white-space: nowrap;">{{ document.date }}</td>
</tr>
{% endfor %}
Expand Down
11 changes: 7 additions & 4 deletions peachjam/templates/peachjam/layouts/document_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
{% block breadcrumbs %}{% endblock %}
{% block document-title %}
<div class="d-md-flex justify-content-md-between py-4">
<h1>{{ document.title }}</h1>
{% include 'peachjam/_labels.html' %}
<div>
<h1>{{ document.title }}</h1>
{% include 'peachjam/_labels.html' %}
</div>
<div class="d-flex align-items-center">
<a href="https://api.whatsapp.com/send?text={{ request.build_absolute_uri }}"
class="btn btn-link"
Expand Down Expand Up @@ -213,8 +215,9 @@ <h1>{{ document.title }}</h1>
</dt>
<dd class="text-muted">
{% for bench in judges %}
{{ bench.judge.name }}
{% if not forloop.last %},{% endif %}
{# djlint:off #}
{{ bench.judge.name }}{% if not forloop.last %},{% endif %}
{# djlint:on #}
{% endfor %}
</dd>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion peachjam/views/courts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CourtDetailView(FilteredDocumentListView):
model = Judgment
template_name = "peachjam/court_detail.html"
navbar_link = "judgments"
queryset = Judgment.objects.prefetch_related("judges")
queryset = Judgment.objects.prefetch_related("bench", "bench__judge", "labels")

def get_base_queryset(self):
qs = super().get_base_queryset().filter(court=self.court)
Expand Down
Loading