From f7fb811e545b3cb00a086343fa27a6bc6d9cb18c Mon Sep 17 00:00:00 2001
From: Benjamin Becker <benjamin.becker@dataport.de>
Date: Wed, 6 Oct 2021 19:01:17 +0000
Subject: [PATCH] feat: Hinweis juris.de

---
 ckanext/odsh/helpers_tpsh.py                     | 11 ++++++++++-
 ckanext/odsh/plugin.py                           |  5 +----
 ckanext/odsh/public/odsh.css                     |  5 +++++
 ckanext/odsh/templates/package/search.html       |  6 ++++++
 ckanext/odsh/templates/snippets/search_form.html |  2 +-
 5 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/ckanext/odsh/helpers_tpsh.py b/ckanext/odsh/helpers_tpsh.py
index 927313ed..695d372e 100644
--- a/ckanext/odsh/helpers_tpsh.py
+++ b/ckanext/odsh/helpers_tpsh.py
@@ -222,4 +222,13 @@ def git_commit_hash():
         command = 'git log -n 1 --format=%H'
     except:
         return 'unknown'
-    return subprocess.check_output([command], shell=True, cwd=current_dir)
\ No newline at end of file
+    return subprocess.check_output([command], shell=True, cwd=current_dir)
+
+def is_informationsgegenstand_gerichtsurteil_selected(fields):
+    try:
+        return "Gerichtsurteil" in fields["subject_text"]
+    except KeyError:
+        return False
+    except:
+        log.exception("this should not raise an exception, fix please")
+        return False
diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py
index a2b0d4a5..800184e2 100644
--- a/ckanext/odsh/plugin.py
+++ b/ckanext/odsh/plugin.py
@@ -384,6 +384,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
             'tpsh_get_address_org':helpers_tpsh.get_address_org,
             'tpsh_get_body_mail':helpers_tpsh.get_body_mail,
             'tpsh_git_commit_hash': helpers_tpsh.git_commit_hash,
+            'tpsh_is_informationsgegenstand_gerichtsurteil_selected': helpers_tpsh.is_informationsgegenstand_gerichtsurteil_selected,
         }
 
     
@@ -413,7 +414,3 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
                         score = s
             if score > 0:
                 dict_pkg['openness'] = OdshPlugin.scores[score-1]
-
-
-
-
diff --git a/ckanext/odsh/public/odsh.css b/ckanext/odsh/public/odsh.css
index d057098f..c987aace 100644
--- a/ckanext/odsh/public/odsh.css
+++ b/ckanext/odsh/public/odsh.css
@@ -2837,3 +2837,8 @@ body.filters-modal div.row > aside.secondary.span3 {
 .tpsh-collection-list {
     list-style-type: none;
 }
+
+.tpsh-hint-gerichtsurteile {
+    font-size: 18px;
+    padding-top: 20px;
+}
diff --git a/ckanext/odsh/templates/package/search.html b/ckanext/odsh/templates/package/search.html
index bf0c5c8a..41704a01 100644
--- a/ckanext/odsh/templates/package/search.html
+++ b/ckanext/odsh/templates/package/search.html
@@ -24,6 +24,12 @@ method="get" data-module="select-switch">
         {{ super() }}
       {% endblock %}
       {% block package_search_results_list %}
+        {% if h.tpsh_is_informationsgegenstand_gerichtsurteil_selected(c.fields_grouped) %}
+        <p class="tpsh-hint-gerichtsurteile">
+            Gerichtsurteile der Gerichte in Schleswig-Holstein werden nicht im Transparenzportal veröffentlicht sondern bei 
+            <a href="https://www.juris.de">juris.de</a>.
+        </p>
+        {% endif %}
         {{ h.snippet('snippets/package_list.html', packages=c.page.items) }}
       {% endblock %}
     </div>
diff --git a/ckanext/odsh/templates/snippets/search_form.html b/ckanext/odsh/templates/snippets/search_form.html
index 9e1ea9ed..d14cbccc 100644
--- a/ckanext/odsh/templates/snippets/search_form.html
+++ b/ckanext/odsh/templates/snippets/search_form.html
@@ -69,7 +69,7 @@
     </div>
     {% endif %}
     {% endblock %}
-
+    
     {% block search_facets %}
     {% if facets %}
     <p class="filter-list">
-- 
GitLab