From edb627fcd29dd1d08ec9379ff975563e5c05da20 Mon Sep 17 00:00:00 2001
From: Thorge Petersen <petersen@rz.uni-kiel.de>
Date: Tue, 20 Feb 2024 13:07:48 +0100
Subject: [PATCH] Show appl. legislation and hvd category in package's info
 sidebar

---
 .../odsh/templates/package/snippets/info.html | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/ckanext/odsh/templates/package/snippets/info.html b/ckanext/odsh/templates/package/snippets/info.html
index 0245241..16e1dd5 100644
--- a/ckanext/odsh/templates/package/snippets/info.html
+++ b/ckanext/odsh/templates/package/snippets/info.html
@@ -91,6 +91,36 @@ Example:
               {% endif %}
             {% endblock musterdatensatz %}
 
+            {% block applicableLegislation %}
+              {% if pkg.applicableLegislation %}
+                {% set applicable_legislation_urls = pkg.applicableLegislation.split(',') %}
+                <div class="applicableLegislation-detail info-detail">
+                  <div>{{ _('Applicable Legislation') }}</div>
+                  <ul class="inline-list">
+                  {% for url in applicable_legislation_urls %}
+                    {% set applicable_legislation = h.odsh_load_applicable_legislations(url.strip('{}')) %}
+                    <li><a href="{{ applicable_legislation.uri }}">{{ applicable_legislation.short_title if applicable_legislation.short_title else applicable_legislation.title }}</a></li>
+                  {% endfor %}
+                  </ul>
+                </div>
+              {% endif %}
+            {% endblock applicableLegislation %}
+
+            {% block hvdCategories %}
+              {% if pkg.hvdCategory %}
+                {% set hvd_urls = pkg.hvdCategory.split(',') %}
+                <div class="hvdCategories-detail info-detail">
+                  <div>{{ _('HVD Categories') }}</div>
+                  <ul class="inline-list">
+                  {% for url in hvd_urls %}
+                    {% set hvd = h.odsh_load_hvd_categories(url.strip('{}')) %}
+                    <li><a href="{{ hvd.uri }}">{{ hvd.short_title if hvd.short_title else hvd.title }}</a></li>
+                  {% endfor %}
+                  </ul>
+                </div>
+              {% endif %}
+            {% endblock hvdCategories %}
+
           {% endblock package_info_inner %}
         </div>
         {% set map_text = h.odsh_get_spatial_text(pkg) %}
-- 
GitLab