Skip to content

Commit

Permalink
Hide Related Catalogue Entries when empty
Browse files Browse the repository at this point in the history
  • Loading branch information
LesterLyu committed Oct 1, 2024
1 parent 27daffa commit 54ea92d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ckanext/udc/templates/package/read.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

{% block package_resources %}

<h2>Related Catalogue Entries:</h2>
<div id="related-packages">
{% for package in pkg_dict.get("related_packages") %}
<a href="{{ h.url_for('catalogue.read', id=package.get("name")) }}" class="d-flex align-items-center mb-2" target="_blank" style="width:fit-content">
<i class="fas fa-up-right-from-square me-2"></i>
<span>{{ package.get("title") }}</span>
</a>
{% endfor %}
</div>
{% if pkg_dict.get("related_packages") | length > 0 %}
<h2>Related Catalogue Entries:</h2>
<div id="related-packages">
{% for package in pkg_dict.get("related_packages") %}
<a href="{{ h.url_for('catalogue.read', id=package.get("name")) }}" class="d-flex align-items-center mb-2" target="_blank" style="width:fit-content">
<i class="fas fa-up-right-from-square me-2"></i>
<span>{{ package.get("title") }}</span>
</a>
{% endfor %}
</div>
{% endif %}

{{ super() }}
{# {% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %} #}
Expand Down

0 comments on commit 54ea92d

Please sign in to comment.