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

Truncate the display of very long PURLs #227 #248

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
{% endif %}
</ul>
<strong>
<a href="{% inject_preserved_filters object.details_url %}">{{ object }}</a>
<a href="{% inject_preserved_filters object.details_url %}"{% if object.identifier|length > 100 %} title="{{ object.identifier }}"{% endif %}>
{{ object.identifier|truncatechars:100 }}
</a>
</strong>
{% if filter.show_created_date %}
<div class="smaller text-muted-darker" title="{{ object.created_date|date:'N j, Y, f A' }}">Created {{ object.created_date|naturaltime_short }}</div>
Expand Down
4 changes: 2 additions & 2 deletions component_catalog/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,8 +1173,8 @@ def test_package_views_urls(self):
def test_package_list_view_content(self):
self.client.login(username=self.super_user.username, password="secret")
response = self.client.get(reverse("component_catalog:package_list"))
self.assertContains(response, self.package1.get_absolute_link())
self.assertContains(response, self.package2.get_absolute_link())
self.assertContains(response, self.package1.get_absolute_link(), html=True)
self.assertContains(response, self.package2.get_absolute_link(), html=True)
self.assertContains(response, self.component1)
self.assertContains(response, self.component2)

Expand Down
2 changes: 1 addition & 1 deletion dje/templates/object_details_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>
<h1 class="header-title text-break">
{% block header_title %}
{{ object }}
{{ object|truncatechars:100 }}
<small class="ms-1" style="font-size: 70%">
{% if is_user_dataspace %}
{% if has_change_permission %}
Expand Down