From fe1172768aadaa0e86da510cb1b0053036c3d782 Mon Sep 17 00:00:00 2001
From: Thorge Petersen <petersen@rz.uni-kiel.de>
Date: Fri, 30 Sep 2022 11:32:37 +0200
Subject: [PATCH] Updated controller to blueprints. Webassets need to be
 readded (also to templates)

---
 ckanext/odsh/collection/controller.py         |   4 +-
 ckanext/odsh/collection/helpers.py            |   2 +-
 ckanext/odsh/controller.py                    |   4 +-
 ckanext/odsh/helpers.py                       |   2 +-
 ckanext/odsh/helpers_tpsh.py                  |   2 +-
 ckanext/odsh/pdf_to_thumbnail/helpers.py      |   2 +-
 ckanext/odsh/plugin.py                        |   1 +
 ckanext/odsh/profiles/odsh_dcat_de_profile.py |   2 +-
 ckanext/odsh/templates/base.html              |   2 -
 .../odsh/templates/datarequests/comment.html  |   2 +-
 .../datarequests/snippets/comment_form.html   |   3 +-
 .../templates/error_document_template.html    |  38 ------
 ckanext/odsh/templates/header.html            |   5 +-
 ckanext/odsh/templates/home/index.html        |   2 +-
 ckanext/odsh/templates/organization/read.html |   2 +-
 ckanext/odsh/templates/package/base.html      |   6 +-
 ckanext/odsh/templates/package/edit_base.html |   4 +-
 .../odsh/templates/package/new_resource.html  |   1 -
 ckanext/odsh/templates/package/read.html      |  10 +-
 .../templates/package/resource_edit_base.html |   5 +-
 .../odsh/templates/package/resource_read.html |   4 +-
 ckanext/odsh/templates/package/search.html    |  10 +-
 .../odsh/templates/package/search.html_neu    | 123 ------------------
 .../snippets/package_basic_fields.html        |   7 -
 .../package/snippets/package_form.html        |   2 +-
 .../package/snippets/resource_form.html       |   9 +-
 .../package/snippets/resource_item.html       |  11 +-
 .../templates/package/snippets/stages.html    |   2 +-
 .../templates/package/view_edit_base.html     |   4 +-
 ckanext/odsh/templates/qa/stars.html          |   1 -
 .../odsh/templates/snippets/dataset_map.html  |   2 -
 ckanext/odsh/templates/snippets/map.html      |   1 -
 .../odsh/templates/snippets/package_item.html |   4 +-
 .../odsh/templates/snippets/search_form.html  |   2 +-
 .../odsh/templates/user/edit_user_form.html   |   3 +-
 ckanext/odsh/tests/test_routes.py             |   2 +-
 ckanext/odsh/tests/test_search.py             |   2 +-
 ckanext/odsh/tests/test_upload.py             |   6 +-
 requirements.txt                              |   3 +-
 39 files changed, 54 insertions(+), 243 deletions(-)
 delete mode 100644 ckanext/odsh/templates/error_document_template.html
 delete mode 100644 ckanext/odsh/templates/package/search.html_neu

diff --git a/ckanext/odsh/collection/controller.py b/ckanext/odsh/collection/controller.py
index 152651b5..cbc89c0b 100644
--- a/ckanext/odsh/collection/controller.py
+++ b/ckanext/odsh/collection/controller.py
@@ -11,7 +11,7 @@ class LatestDatasetController(PackageController):
         latest_dataset= get_latest_dataset(id)
         if latest_dataset is None:
             toolkit.abort(404)
-        toolkit.redirect_to(controller='package', action='read', id=latest_dataset)
+        toolkit.redirect_to(controller='dataset', action='read', id=latest_dataset)
 
 class LatestRecourcesController(PackageController):
     
@@ -30,7 +30,7 @@ class LatestRecourcesController(PackageController):
             if is_url(pre_resource_url):
                 url_resource = pre_resource_url
             else:
-                url_resource = url_for(controller='package',
+                url_resource = url_for(controller='dataset',
                                     action='resource_download',
                                     id=download_package_id,
                                     resource_id=download_resource_id,
diff --git a/ckanext/odsh/collection/helpers.py b/ckanext/odsh/collection/helpers.py
index fcd73083..cefd9f03 100644
--- a/ckanext/odsh/collection/helpers.py
+++ b/ckanext/odsh/collection/helpers.py
@@ -151,7 +151,7 @@ def gather_collection_info(collection_dict, datasets_in_collection, dataset_dict
     }
 
 def url_from_id(package_id):
-    return helpers.url_for(controller='package', action='read', id=package_id)
+    return helpers.url_for(controller='dataset', action='read', id=package_id)
 
 def url_last_member(name_collection):
     return helpers.url_for(
diff --git a/ckanext/odsh/controller.py b/ckanext/odsh/controller.py
index 8a0a8991..ac63f954 100644
--- a/ckanext/odsh/controller.py
+++ b/ckanext/odsh/controller.py
@@ -51,7 +51,7 @@ class OdshUserController(UserController):
             h.redirect_to(locale=locale, controller='user', action='login',
                           id=None)
         user_ref = c.userobj.get_reference_preferred_for_uri()
-        h.redirect_to(locale=locale, controller='package', action='search')
+        h.redirect_to(locale=locale, controller='dataset', action='search')
 
     def dashboard(self, id=None, offset=0):
         if not authz.is_sysadmin(c.user):
@@ -223,7 +223,7 @@ class OdshFeedController(FeedController):
         navigation_urls = self._navigation_urls(request.params,
                                                 item_count=item_count,
                                                 limit=data_dict['rows'],
-                                                controller='feed',
+                                                controller='feeds',
                                                 action='custom')
 
         feed_url = self._feed_url(request.params,
diff --git a/ckanext/odsh/helpers.py b/ckanext/odsh/helpers.py
index eeb3644a..d72c1b3a 100644
--- a/ckanext/odsh/helpers.py
+++ b/ckanext/odsh/helpers.py
@@ -434,7 +434,7 @@ def get_package_dict(name):
 def tpsh_get_successor_and_predecessor_urls(context, pkg_dict):
     successor_name, predecessor_name = tpsh_get_successor_and_predecessor_dataset(context, pkg_dict)
     successor_url, predecessor_url = (
-        helpers.url_for(controller='package', action='read', id=name)
+        helpers.url_for(controller='dataset', action='read', id=name)
         if name is not None
         else None
         for name in (successor_name, predecessor_name)
diff --git a/ckanext/odsh/helpers_tpsh.py b/ckanext/odsh/helpers_tpsh.py
index 4528e1e4..97e84b04 100644
--- a/ckanext/odsh/helpers_tpsh.py
+++ b/ckanext/odsh/helpers_tpsh.py
@@ -206,7 +206,7 @@ def get_address_org(organization):
 
 def get_body_mail(organization, package):
     package_name = package.get('name')
-    url = helpers.url_for(controller='package', action='read', id=package_name, qualified = True)
+    url = helpers.url_for(controller='dataset', action='read', id=package_name, qualified = True)
     title = package.get('title')
     anrede = "Sehr geehrte Damen und Herren," + "%0D%0A" +  "%0D%0A" + "zu folgendem Eintrag habe ich eine Anmerkung/Frage:" + "%0D%0A" + "%0D%0A" 
     mail_titel = "Titel: " + title + "%0D%0A"    
diff --git a/ckanext/odsh/pdf_to_thumbnail/helpers.py b/ckanext/odsh/pdf_to_thumbnail/helpers.py
index faddfaa0..33409443 100644
--- a/ckanext/odsh/pdf_to_thumbnail/helpers.py
+++ b/ckanext/odsh/pdf_to_thumbnail/helpers.py
@@ -16,7 +16,7 @@ def get_download_link_for_thumbnail(package):
             if is_url(pre_resource_url):
                 url_resource = pre_resource_url
             else:
-                url_resource = url_for(controller='package',
+                url_resource = url_for(controller='dataset',
                                     action='resource_download',
                                     id=package_id,
                                     resource_id=resource_id,
diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py
index 200279c9..7ec598bb 100644
--- a/ckanext/odsh/plugin.py
+++ b/ckanext/odsh/plugin.py
@@ -6,6 +6,7 @@ from multiline_formatter.formatter import MultilineMessagesFormatter
 import os
 from routes.mapper import SubMapper
 import sys
+from collections import OrderedDict
 
 # imports from ckan
 import ckan.lib.helpers as helpers
diff --git a/ckanext/odsh/profiles/odsh_dcat_de_profile.py b/ckanext/odsh/profiles/odsh_dcat_de_profile.py
index fc136aa9..889e8bab 100644
--- a/ckanext/odsh/profiles/odsh_dcat_de_profile.py
+++ b/ckanext/odsh/profiles/odsh_dcat_de_profile.py
@@ -186,7 +186,7 @@ class ODSHDCATdeProfile(DCATdeProfile):
     @staticmethod
     def _construct_refs(id):
         public_url = config.get('ckan.site_url')
-        url_to_id = helpers.url_for(controller='package', action='read', id=id)
+        url_to_id = helpers.url_for(controller='dataset', action='read', id=id)
         ref = public_url + url_to_id
         return ref
 
diff --git a/ckanext/odsh/templates/base.html b/ckanext/odsh/templates/base.html
index 93835b96..94f9a9b5 100644
--- a/ckanext/odsh/templates/base.html
+++ b/ckanext/odsh/templates/base.html
@@ -2,11 +2,9 @@
 
 {% block styles %}
 {{ super() }}
-{% resource 'odsh/odsh.js' %}
 <link rel="stylesheet" href="/odsh.css?refresh={{ range(1,10000) | random }}" />
 <link rel="stylesheet" href="/odsh_header.css?refresh={{ range(1,10000) | random }}" />
 <link rel="stylesheet" href="/bootstrap-multiselect.css" />
-{% resource 'odsh/autocomplete' %}
 {% endblock %}
 
 {% block head_extras %}
diff --git a/ckanext/odsh/templates/datarequests/comment.html b/ckanext/odsh/templates/datarequests/comment.html
index 25e9567b..d64bfa83 100644
--- a/ckanext/odsh/templates/datarequests/comment.html
+++ b/ckanext/odsh/templates/datarequests/comment.html
@@ -70,7 +70,7 @@
             <th scope="row" class="dataset-label">{{ _('Accepted Dataset') }}</th>
             <td class="dataset-details">
             {% if c.datarequest.accepted_dataset %}
-              {% link_for c.datarequest.accepted_dataset['title'], controller='package', action='read', id=c.datarequest.accepted_dataset.get('id') %}
+              {% link_for c.datarequest.accepted_dataset['title'], controller='dataset', action='read', id=c.datarequest.accepted_dataset.get('id') %}
             {% else %}
               {{ _('None') }}
             {% endif %}
diff --git a/ckanext/odsh/templates/datarequests/snippets/comment_form.html b/ckanext/odsh/templates/datarequests/snippets/comment_form.html
index fedeb4e3..b768f40b 100644
--- a/ckanext/odsh/templates/datarequests/snippets/comment_form.html
+++ b/ckanext/odsh/templates/datarequests/snippets/comment_form.html
@@ -1,5 +1,4 @@
 {% import 'macros/form.html' as form %}
-{% resource "datarequest/edit_comment.js" %}
 
 <form class="dataset-form {{ 'comment-edit-form' if comment_id else 'odsh-comment-wrapper' }} {{ 'hide' if comment_id and not (focus and errors) }} form-horizontal" id="comment-form{{ '-' + comment_id if comment_id }}" method="post" data-module="basic-form" action enctype="multipart/form-data">
 
@@ -26,4 +25,4 @@
     {% endif %}
   </div>
 
-</form>
\ No newline at end of file
+</form>
diff --git a/ckanext/odsh/templates/error_document_template.html b/ckanext/odsh/templates/error_document_template.html
deleted file mode 100644
index 80ede950..00000000
--- a/ckanext/odsh/templates/error_document_template.html
+++ /dev/null
@@ -1,38 +0,0 @@
-{% extends "page.html" %}
-
-{% block subtitle %}{{ gettext('Error %(error_code)s', error_code=c.code[0]) }}{% endblock %}
-
-{% block primary %}
-  <article class="module">
-    <div class="module-content error-page">
-        <div class="error-title">
-            HTTP Status {{ c.code[0]}}
-            {%if c.code[0]=='404' or c.code[0]=='403'%}
-                {%if c.code[0]=='404'%}
-                  <div class="error-body"><h2>Seite nicht gefunden</h2>
-                {%elif c.code[0]=='403'%}
-                  <div class="error-body"><h2>Zugriff nicht erlaubt</h2>
-                {% endif %}
-                <h3>Wie finde ich die gesuchten Inhalte im Landesportal?</h3>
-
-                <p><a class="" href="http://www.schleswig-holstein.de/odpstart" title="Zur Startseite">Zur Startseite des Open-Data-Portals</a></p>
-
-                <h3>Kontakt</h3>
-                <p>Bei Fragen oder Problemen mit dem Open-Data-Portal schicken Sie bitte eine E-Mail an die Adresse opendata@lr.landsh.de oder verwenden das Kontaktformular:</p>
-                <p><a class="" href="https://www.schleswig-holstein.de/odpkontakt" title="Kontakt">Zum Kontaktformular</a></p>
-            </div>
-            {% endif %}
-        </div>
-    </div>
-  </article>
-{% endblock %}
-
-{% block breadcrumb %}
-{% endblock %}
-
-{% block flash %}
-  {# eat the flash messages caused by the 404 #}
-  {% set flash_messages = h.flash.pop_messages() %}
-{% endblock %}
-
-{% block secondary %}{% endblock %}
diff --git a/ckanext/odsh/templates/header.html b/ckanext/odsh/templates/header.html
index ce28006f..d03b6ba1 100644
--- a/ckanext/odsh/templates/header.html
+++ b/ckanext/odsh/templates/header.html
@@ -1,4 +1,3 @@
-{% resource 'odsh/tpsh_toggle_menu.js' %}
 
 {% block header_wrapper %}
 {% block header_account %}
@@ -45,8 +44,7 @@
                     {{ 
                     h.build_nav_main(
                         ('search', _('Datensätze')),
-                        ('organizations_index', _('Herausgeber')),
-                        ('info_page', _('Infos'))
+                        ('organizations_index', _('Herausgeber'))
                     )
                     }}
                     {% endblock %}
@@ -56,7 +54,6 @@
                         <a href="/harvest">Harvester</a>
                     </li>
                     <li class='{{clazz}}'>
-                        {% link_for _('Upload'), controller='package', action='new', group=c.group_dict.id, class_='text' %}
                     </li>
                     {% endif %}
                     {% if c.userobj %}
diff --git a/ckanext/odsh/templates/home/index.html b/ckanext/odsh/templates/home/index.html
index ae3f5ce4..bd567402 100644
--- a/ckanext/odsh/templates/home/index.html
+++ b/ckanext/odsh/templates/home/index.html
@@ -26,7 +26,7 @@ Datensätze entdecken
     <div class='home-groups-rows'>
         {% for group in group_row %}
         {% if group != '' %}
-            {% set href = h.add_url_param(controller='package', action='search',extras={'groups':group.id} ) %}
+            {% set href = h.add_url_param(controller='dataset', action='search',extras={'groups':group.id} ) %}
             <div class='home_group_item'>
             <div class='home-groups-img'>
                 <img  src="/base/images/icon_kat_{{group.id}}.svg"/>
diff --git a/ckanext/odsh/templates/organization/read.html b/ckanext/odsh/templates/organization/read.html
index f123517f..43eff5f2 100644
--- a/ckanext/odsh/templates/organization/read.html
+++ b/ckanext/odsh/templates/organization/read.html
@@ -2,7 +2,7 @@
 
 {% block page_primary_action %}
 {% if h.check_access('package_create', {'owner_org': c.group_dict.id}) %}
-{% link_for _('Add Dataset'), controller='package', action='new', group=c.group_dict.id, class_='btn btn-primary',
+{% link_for _('Add Dataset'), controller='dataset', action='new', group=c.group_dict.id, class_='btn btn-primary',
 icon='plus-square' %}
 {% endif %}
 {% endblock %}
diff --git a/ckanext/odsh/templates/package/base.html b/ckanext/odsh/templates/package/base.html
index 0d0920d5..afb926ae 100644
--- a/ckanext/odsh/templates/package/base.html
+++ b/ckanext/odsh/templates/package/base.html
@@ -14,12 +14,12 @@
 <li>{% link_for _('Organizations'), controller='organization', action='index' %}</li>
 <li>{% link_for organization|truncate(30), controller='organization', action='read', id=pkg.organization.name %}</li>
 {% else %}
-<li>{% link_for _('Datasets'), controller='package', action='search' %}</li>
+<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li>
 {% endif %}
-<li {{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), controller='package', action='read',
+<li {{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), controller='dataset', action='read',
     id=pkg.name %}</li>
 {% else %}
-<li>{% link_for _('Datasets'), controller='package', action='search' %}</li>
+<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li>
 <li class="active"><a href="">{{ _('Create Dataset') }}</a></li>
 {% endif %}
 {% endblock %}
\ No newline at end of file
diff --git a/ckanext/odsh/templates/package/edit_base.html b/ckanext/odsh/templates/package/edit_base.html
index 8c3cbb67..fe977acd 100644
--- a/ckanext/odsh/templates/package/edit_base.html
+++ b/ckanext/odsh/templates/package/edit_base.html
@@ -7,7 +7,7 @@
 
 {% block breadcrumb_content %}
 {% if pkg %}
-<li class="active">{% link_for _('Edit'), controller='package', action='edit', id=pkg.name %}</li>
+<li class="active">{% link_for _('Edit'), controller='dataset', action='edit', id=pkg.name %}</li>
 {% else %}
 <li class="active"><a href="">{{ _('odsh Create Dataset') }}</a></li>
 {% endif %}
@@ -23,7 +23,7 @@
 {% block primary_content %}
 <div class="odsh-dataset-heading">
     <div class='title'>Datensatz &quot;{{h.dataset_display_name(pkg)}}&quot; bearbeiten</div>
-   {% link_for  _('back'), controller='package', action='read', id=pkg.name, class_='btn btn-heading', icon='arrow-left' %}
+   {% link_for  _('back'), controller='dataset', action='read', id=pkg.name, class_='btn btn-heading', icon='arrow-left' %}
 <span class="clear"></span>
 </div>
 {{ super() }}
diff --git a/ckanext/odsh/templates/package/new_resource.html b/ckanext/odsh/templates/package/new_resource.html
index 31afa253..bbe3e1de 100644
--- a/ckanext/odsh/templates/package/new_resource.html
+++ b/ckanext/odsh/templates/package/new_resource.html
@@ -21,5 +21,4 @@ dataset_type=dataset_type %}{% endblock %}
 
 {% block scripts %}
 {{ super() }}
-{% resource 'vendor/fileupload' %}
 {% endblock %}
diff --git a/ckanext/odsh/templates/package/read.html b/ckanext/odsh/templates/package/read.html
index a240de16..1b93ed54 100644
--- a/ckanext/odsh/templates/package/read.html
+++ b/ckanext/odsh/templates/package/read.html
@@ -16,12 +16,12 @@
 {% set organization = h.get_translated(pkg.organization, 'title') or pkg.organization.name %}
 <li>{% link_for organization|truncate(30), controller='organization', action='read', id=pkg.organization.name %}</li>
 {% else %}
-<li>{% link_for _('Datasets'), controller='package', action='search' %}</li>
+<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li>
 {% endif %}
-<li {{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), controller='package', action='read',
+<li {{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), controller='dataset', action='read',
   id=pkg.name %}</li>
 {% else %}
-<li>{% link_for _('Datasets'), controller='package', action='search' %}</li>
+<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li>
 <li class="active"><a href="">{{ _('Create Dataset') }}</a></li>
 {% endif %}
 {% endblock breadcrumb_content %}
@@ -43,7 +43,7 @@
     <div class="odsh-dataset-edit-button">
       {% if h.check_access('package_update', {'id':pkg.id }) %}
       <div>
-        {% link_for _('Manage Dataset'), controller='package', action='edit', id=pkg.name, class_='btn btn-primary btn-add-dataset',
+        {% link_for _('Manage Dataset'), controller='dataset', action='edit', id=pkg.name, class_='btn btn-primary btn-add-dataset',
         icon='wrench' %}
       </div>
       {% endif %}
@@ -88,7 +88,7 @@
 {% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %}
   {% if h.check_access('package_update', {'id':pkg.id }) %}
       <div class='add-resource-container'>
-        {% link_for _('Add new resource'), controller='package', action='new_resource', id=c.pkg_dict.name, class_='btn btn-primary', icon='plus' %}
+        {% link_for _('Add new resource'), controller='resource', action='new', id=c.pkg_dict.name, class_='btn btn-primary', icon='plus' %}
       </div>
   {% endif %}
 {% endblock package_resources %}
diff --git a/ckanext/odsh/templates/package/resource_edit_base.html b/ckanext/odsh/templates/package/resource_edit_base.html
index 57facf38..13391e85 100644
--- a/ckanext/odsh/templates/package/resource_edit_base.html
+++ b/ckanext/odsh/templates/package/resource_edit_base.html
@@ -8,7 +8,7 @@
 {% block breadcrumb_content %}
   {{ super() }}
   {% if res %}
-    <li>{% link_for h.resource_display_name(res)|truncate(30), controller='package', action='resource_read', id=pkg.name, resource_id=res.id %}</li>
+    <li>{% link_for h.resource_display_name(res)|truncate(30), controller='resource', action='read', id=pkg.name, resource_id=res.id %}</li>
     <li{% block breadcrumb_edit_selected %} class="active"{% endblock %}><a href="">{{ _('Edit') }}</a></li>
   {% endif %}
 {% endblock %}
@@ -25,7 +25,7 @@
   {% if res %}
 <div class="odsh-dataset-heading">
     <span class='title'>Ressource {%if(res.name)%}&#65282;{{res.name}}&#65282;{%endif%} bearbeiten</span>
-    {% link_for _('back'), controller='package', action='resource_read', id=pkg.name, resource_id=res.id, class_='btn btn-heading', icon='arrow-left' %}
+    {% link_for _('back'), controller='resource', action='read', id=pkg.name, resource_id=res.id, class_='btn btn-heading', icon='arrow-left' %}
 <span class="clear"></span>
 </div>
   {% endif %}
@@ -40,5 +40,4 @@
 
 {% block scripts %}
   {{ super() }}
-  {% resource 'vendor/fileupload' %}
 {% endblock %}
diff --git a/ckanext/odsh/templates/package/resource_read.html b/ckanext/odsh/templates/package/resource_read.html
index a7ffbc0b..c997a631 100644
--- a/ckanext/odsh/templates/package/resource_read.html
+++ b/ckanext/odsh/templates/package/resource_read.html
@@ -28,7 +28,7 @@
           <ul>
             {% block resource_actions_inner %}
             {% if h.check_access('package_update', {'id':pkg.id }) %}
-              <li>{% link_for _('Manage'), controller='package', action='resource_edit', id=pkg.name, resource_id=res.id, class_='btn', icon='wrench' %}</li>
+              <li>{% link_for _('Manage'), controller='dataset', action='edit', id=pkg.name, resource_id=res.id, class_='btn', icon='wrench' %}</li>
             {% endif %}
             {% if res.url and h.is_url(res.url) %}
               <li>
@@ -65,7 +65,7 @@
             {% if not res.description and c.package.notes %}
               <h3>{{ _('From the dataset abstract') }}</h3>
               <blockquote>{{ h.markdown_extract(h.get_translated(c.package, 'notes')) }}</blockquote>
-              <p>{% trans dataset=c.package.title, url=h.url_for(controller='package', action='read', id=c.package['name']) %}Source: <a href="{{ url }}">{{ dataset }}</a>{% endtrans %}
+              <p>{% trans dataset=c.package.title, url=h.url_for(controller='dataset', action='read', id=c.package['name']) %}Source: <a href="{{ url }}">{{ dataset }}</a>{% endtrans %}
             {% endif %}
           </div>
         {% endblock %}
diff --git a/ckanext/odsh/templates/package/search.html b/ckanext/odsh/templates/package/search.html
index 06d6c822..73780a16 100644
--- a/ckanext/odsh/templates/package/search.html
+++ b/ckanext/odsh/templates/package/search.html
@@ -2,12 +2,12 @@
 
 
 {% block breadcrumb_content %}
-  <li class="active">{{ h.nav_link(_('Datasets'), controller='package', action='search', highlight_actions = 'new index') }}</li>
+  <li class="active">{{ h.nav_link(_('Datasets'), controller='dataset', action='search', highlight_actions = 'new index') }}</li>
 {% endblock %}
 
 {% block toolbar %}
 {{ super() }}
-<form id='dataset-search-box-form' class="section site-search simple-input" action="{% url_for controller='package', action='search' %}"
+<form id='dataset-search-box-form' class="section site-search simple-input" action="{% url_for controller='dataset', action='search' %}"
 method="get" data-module="select-switch">
     <div class="row filter-search-row">
         <div class='btn show-filters'>Filter</div>
@@ -43,7 +43,7 @@ method="get" data-module="select-switch">
     <div class="container-fluid filter-reset">
         <div class="filter-reset-label"><span>Filter:</span></div>
         <div class="filter-reset-box">
-            <a href="{{h.url_for(controller='package', action='search')}}">zurücksetzen</a>
+            <a href="{{h.url_for(controller='dataset', action='search')}}">zurücksetzen</a>
         </div>
     </div>
 </div>
@@ -62,10 +62,6 @@ method="get" data-module="select-switch">
       <div class="nav-title">{{_('timerange')}}</div>
       <div class="rangesearch-controls">
           {% import 'macros/form.html' as form %}
-          {% resource 'odsh/moment.js' %}
-          {% resource 'odsh/datepicker.css' %}
-          {% resource 'odsh/bootstrap-datepicker.js' %}
-          {% resource 'odsh/odsh_datepicker.js' %}
           <div class='controls rangesearch' >
             {%- set start = request.params['ext_startdate'] -%}
             {%- set start_error = h.odsh_render_datetime(start, False) == '' and start -%}
diff --git a/ckanext/odsh/templates/package/search.html_neu b/ckanext/odsh/templates/package/search.html_neu
deleted file mode 100644
index cadf27f0..00000000
--- a/ckanext/odsh/templates/package/search.html_neu
+++ /dev/null
@@ -1,123 +0,0 @@
-{% ckan_extends %}
-
-
-{% block breadcrumb_content %}
-  <li class="active">{{ h.nav_link(_('Documents'), controller='package', action='search', highlight_actions = 'new index') }}</li>
-{% endblock %}
-
-{% block toolbar %}
-{{ super() }}
-<form id='dataset-search-box-form' class="section site-search simple-input" action="{% url_for controller='package', action='search' %}"
-method="get" data-module="select-switch">
-    <div class="row filter-search-row">
-        <div class='btn show-filters'>Filter</div>
-        {% snippet "snippets/search_box.html"%}
-    </div>
-{% endblock %}
-
-{% block primary_content %}
-  <section class="module">
-    <div class="module-content">
-      {% block page_primary_action %}
-      {% endblock %}
-      {% block form %}
-        {{ super() }}
-      {% endblock %}
-      {% block package_search_results_list %}
-        {{ h.snippet('snippets/package_list.html', packages=c.page.items) }}
-      {% endblock %}
-    </div>
-
-    {% block page_pagination %}
-    {{ c.page.pager(q=c.q,symbol_next='>') }}
-    {% endblock %}
-  </section>
-
-  {% block package_search_results_api %}
-  {% endblock %}
-{% endblock %}
-
-
-{% block secondary_content %}
-<div class="filters">
-    {% snippet "package/snippets/close_mobile_sidebar_button.html" %}
-    <div class="container-fluid filter-reset">
-        <div class="filter-reset-label"><span>Filter:</span></div>
-        <div class="filter-reset-box">
-            <a href="{{h.url_for(controller='package', action='search')}}">zurücksetzen</a>
-        </div>
-    </div>
-</div>
-{% snippet "snippets/map.html",
-default_extent="{ \"type\": \"Polygon\", \"coordinates\": [[[7.6574,53.1632],[11.8322,53.1632],[11.8322,55.1066],
-[7.6574,55.1066],[7.6574,53.1632]]] }"%}
-<div class="filters">
-  <div>
-    {% for facet in c.facet_titles %}
-    {{ h.snippet('snippets/facet_list.html', title=c.facet_titles[facet], name=facet) }}
-    {% endfor %}
-  </div>
-
-  {% block datereange_search %}
-  {% set has_range_filter = request.params.get('ext_startdate') or request.params.get('ext_enddate') %}
-  <section class="module module-narrow module-shallow">
-    <nav>
-      <div class="nav-title">{{_('timerange')}}</div>
-      <div class="rangesearch-controls">
-          {% import 'macros/form.html' as form %}
-          {% resource 'odsh/moment.js' %}
-          {% resource 'odsh/datepicker.css' %}
-          {% resource 'odsh/bootstrap-datepicker.js' %}
-          {% resource 'odsh/odsh_datepicker.js' %}
-          <div class='controls rangesearch' >
-            {%- set start = request.params['ext_startdate'] -%}
-            {%- set start_error = h.odsh_render_datetime(start, False) == '' and start -%}
-            {%- set end = request.params['ext_enddate'] -%}
-            {%- set end_error = h.odsh_render_datetime(end, False) == '' and end -%}
-            {%- set typeStart = 'text' if (start_error or not start) else 'date' -%}
-            {%- set typeEnd = 'text' if (end_error or not end) else 'date' -%}
-            
-            <label for="ext_startdate">{{_('from')|title}}</label>
-            {% 
-              snippet 'snippets/datepicker.html', 
-              aria_label=_('date start'), 
-              id='ext_startdate', 
-              value=start, 
-              class='rangesearch', 
-              placeholder=_('Date') 
-            %}
-            {%if start_error %}
-              <div class="error-reange-search">
-                  {{_('wrong_start_date_for_search')}}
-              </div>
-            {%endif%}
-            
-            <label for="ext_enddate">{{_('to')|title}}</label>
-            {% 
-              snippet 'snippets/datepicker.html', 
-              aria_label=_('date end'),
-              id='ext_enddate', 
-              value=end, 
-              class='rangesearch', 
-              placeholder=_('Date') 
-            %}
-            {%if end_error %}
-              <div class="error-reange-search">
-                  {{_('wrong_end_date_for_search')}}
-              </div>
-            {%endif%}
-            <a class='pull-right' href="javascript:{}" onclick="$('#dataset-search-box-form').submit();" class="action">{{_('submit date search') }}</a>
-          </div>
-      </div>
-    </nav>
-  </section>
-  </div>
- <a class="close no-text hide-filters"><i class="fa fa-times-circle"></i><span class="text">close</span></a>
-  {% endblock %}
-
-</div>
-{% endblock %}
-
-{% block pre_wrap %}
-</form>
-{% endblock %}
diff --git a/ckanext/odsh/templates/package/snippets/package_basic_fields.html b/ckanext/odsh/templates/package/snippets/package_basic_fields.html
index 2227d7b8..9121bb09 100644
--- a/ckanext/odsh/templates/package/snippets/package_basic_fields.html
+++ b/ckanext/odsh/templates/package/snippets/package_basic_fields.html
@@ -1,7 +1,4 @@
 {% import 'macros/form.html' as form %}
-{% resource 'odsh/odsh_form.js' %}
-{% resource 'odsh/odsh_populate_tags.js' %}
-{% resource 'odsh/bootstrap-multiselect.js' %}
 {% set dataset_is_draft = data.get('state', 'draft').startswith('draft') or data.get('state', 'none') == 'none' %}
 
 
@@ -139,10 +136,6 @@ dataset_is_draft)) %}
     {# <span title="{{ _("This field is required") }}" class="control-required">*</span> #}
 </label>
 <div class='row-fluid'>
-        {% resource 'odsh/moment.js' %}
-        {% resource 'odsh/datepicker.css' %}
-        {% resource 'odsh/bootstrap-datepicker.js' %}
-        {% resource 'odsh/odsh_datepicker.js' %}
     <div id='start-end' class='span3'>
         {# field temporal_start #}
         {% set field = 'temporal_start' %}
diff --git a/ckanext/odsh/templates/package/snippets/package_form.html b/ckanext/odsh/templates/package/snippets/package_form.html
index aea803a5..e01dc075 100644
--- a/ckanext/odsh/templates/package/snippets/package_form.html
+++ b/ckanext/odsh/templates/package/snippets/package_form.html
@@ -27,7 +27,7 @@
             <div class="span6">
                 {% block delete_button %}
                 {% if h.check_access('package_delete', {'id': data.id}) and not data.state == 'deleted' %}
-                <a class="btn btn-danger pull-left" href="{% url_for controller='package', action='delete', id=data.id %}"
+                <a class="btn btn-danger pull-left" href="{% url_for controller='dataset', action='delete', id=data.id %}"
                     data-module="confirm-action" data-module-content="{{ _('Are you sure you want to delete this dataset?') }}">{%
                     block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
                 {% endif %}
diff --git a/ckanext/odsh/templates/package/snippets/resource_form.html b/ckanext/odsh/templates/package/snippets/resource_form.html
index 83db57db..cbc2617a 100644
--- a/ckanext/odsh/templates/package/snippets/resource_form.html
+++ b/ckanext/odsh/templates/package/snippets/resource_form.html
@@ -1,11 +1,9 @@
-{% resource 'odsh/odsh_image-upload.js' %}
-{% resource 'odsh/odsh_form.js' %}
 {% import 'macros/form.html' as form %}
 
 {% set data = data or {} %}
 {% set errors = errors or {} %}
 {% set active = data and data.state=='active' %}
-{% set action = form_action or h.url_for(controller='package', action='new_resource', id=pkg_name) %}
+{% set action = form_action or h.url_for(controller='dataset', action='new_resource', id=pkg_name) %}
 
 <form id="resource-edit" class="dataset-form dataset-resource-form {%if(data)%}resource-edit-form{%endif%}" method="post" action="{{ action }}" data-module="basic-form resource-form"
     enctype="multipart/form-data" novalidate>
@@ -66,7 +64,6 @@
 
     
     {% block basic_fields_format %}
-      {% resource 'odsh/odsh_guessformat.js' %}
 
       {% set format_attrs = {'data-module': 'odsh_guessformat', 'data-module-formats':h.odsh_upload_known_formats()} %}
       {% set format_attrs = {} %}
@@ -94,7 +91,7 @@
                 {% block delete_button %}
                 {% if data.id %}
                 {% if h.check_access('resource_delete', {'id': data.id}) %}
-                <a class="btn btn-danger pull-left" href="{% url_for controller='package', action='resource_delete', resource_id=data.id, id=pkg_name %}"
+                <a class="btn btn-danger pull-left" href="{% url_for controller='dataset', action='resource_delete', resource_id=data.id, id=pkg_name %}"
                     data-module="confirm-action" data-module-content="{{ _('Are you sure you want to delete this resource?') }}">{%
                     block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
                 {% endif %}
@@ -118,4 +115,4 @@
         </div>
     </div>
     <span class='required-text'>*Pflichtangabe</span>
-</form>
\ No newline at end of file
+</form>
diff --git a/ckanext/odsh/templates/package/snippets/resource_item.html b/ckanext/odsh/templates/package/snippets/resource_item.html
index 296f03aa..02540180 100644
--- a/ckanext/odsh/templates/package/snippets/resource_item.html
+++ b/ckanext/odsh/templates/package/snippets/resource_item.html
@@ -1,8 +1,7 @@
-{% set url_action = 'resource_edit' if url_is_edit and can_edit else 'resource_read' %}
-{% set url = h.url_for(controller='package', action=url_action, id=pkg.name, resource_id=res.id) %}
+{% set url_action = 'edit' if url_is_edit and can_edit else 'read' %}
+{% set url = h.url_for(controller='resource', action=url_action, id=pkg.name, resource_id=res.id) %}
 
-{# hack for correcting slave url if resource was uploaded #}
-{% set download = h.odsh_public_resource_url(res) or url %}
+{% set download = url %}
 
 {% set rtitle=h.resource_display_name(res) if res.name else ' '%}
 {% set resource_size = h.tpsh_get_resource_size(res) %}
@@ -30,7 +29,7 @@
                 <div aria-hidden="true" class="icon icon-download"></div>
             </a>
             {% if can_edit %}
-            <a href="{{ h.url_for(controller='package', action='resource_edit', id=pkg.name, resource_id=res.id) }}">
+            <a href="{{ h.url_for(controller='resource', action='edit', id=pkg.name, resource_id=res.id) }}">
                 <div class="icon icon-edit"></div>
             </a>
             {% endif %}
@@ -52,7 +51,7 @@
           <div aria-hidden="true" class="icon icon-download"></div>
         </a>
         {% if can_edit %}
-        <a href="{{ h.url_for(controller='package', action='resource_edit', id=pkg.name, resource_id=res.id) }}">
+        <a href="{{ h.url_for(controller='resource', action='edit', id=pkg.name, resource_id=res.id) }}">
           <div class="icon icon-edit"></div>
         </a>
         {% endif %}
diff --git a/ckanext/odsh/templates/package/snippets/stages.html b/ckanext/odsh/templates/package/snippets/stages.html
index eb13f8bd..c498d12d 100644
--- a/ckanext/odsh/templates/package/snippets/stages.html
+++ b/ckanext/odsh/templates/package/snippets/stages.html
@@ -33,7 +33,7 @@ Example:
         {# stage 1 #}
         <button class="highlight" name="save" value="go-resources" type="submit">{{ _('Add dataset') }}</button>
         {% else %}
-        {% link_for _('Add dataset'), controller='package', action='new', class_="highlight" %}
+        {% link_for _('Add dataset'), controller='dataset', action='new', class_="highlight" %}
         {% endif %}
         {% endif %}
     </li>
diff --git a/ckanext/odsh/templates/package/view_edit_base.html b/ckanext/odsh/templates/package/view_edit_base.html
index d8a9736f..416929c1 100644
--- a/ckanext/odsh/templates/package/view_edit_base.html
+++ b/ckanext/odsh/templates/package/view_edit_base.html
@@ -6,9 +6,9 @@
 {% block breadcrumb_edit_selected %}{% endblock %}
 
 {% block content_action %}
-  {% link_for _('All views'), controller='package', action='resource_views', id=pkg.name, resource_id=res.id, class_='btn', icon='arrow-left' %}
+  {% link_for _('All views'), controller='resource', action='views', id=pkg.name, resource_id=res.id, class_='btn', icon='arrow-left' %}
   {% if res %}
-    {% set url = h.url_for(controller='package', action='resource_read', id=pkg.name, resource_id=res.id) ~ '?view_id=' ~ resource_view.id %}
+    {% set url = h.url_for(controller='resource', action='read', id=pkg.name, resource_id=res.id) ~ '?view_id=' ~ resource_view.id %}
     <a href="{{ url }}" class="btn"><i class="fa fa-eye"></i> {{ _('View view') }}</a>
   {% endif %}
 {% endblock %}
diff --git a/ckanext/odsh/templates/qa/stars.html b/ckanext/odsh/templates/qa/stars.html
index 28387a05..cad50702 100644
--- a/ckanext/odsh/templates/qa/stars.html
+++ b/ckanext/odsh/templates/qa/stars.html
@@ -11,7 +11,6 @@ reason - A reason why the dataset doesn't have a rating.
 {% set short_texts=['', ': OL', ': RE', ': OF', ': URI', ': LD'] %}
 {% set texts=['OL = offene Lizenz', 'RE = maschinenlesbar', 'OF = offenes Format', 'URI = verwendet URIs', 'LD = Linked Data'] %}
 <span class="star-rating{% if stars == 0 %} no-stars{% endif %}">
-{% resource 'odsh/odsh_popover.js' %}
   {%- if stars == None -%}
   {{ reason }}
   {%- else -%}
diff --git a/ckanext/odsh/templates/snippets/dataset_map.html b/ckanext/odsh/templates/snippets/dataset_map.html
index 503fb993..896c271b 100644
--- a/ckanext/odsh/templates/snippets/dataset_map.html
+++ b/ckanext/odsh/templates/snippets/dataset_map.html
@@ -6,5 +6,3 @@
     {% snippet "spatial/snippets/map_attribution.html", map_config=map_config %}
   </div>
 </div>
-
-{% resource 'odsh/odsh_dataset_map' %}
diff --git a/ckanext/odsh/templates/snippets/map.html b/ckanext/odsh/templates/snippets/map.html
index 75ed9858..9cbde6c8 100644
--- a/ckanext/odsh/templates/snippets/map.html
+++ b/ckanext/odsh/templates/snippets/map.html
@@ -14,4 +14,3 @@
   </div>
 </section>
 
-{% resource 'odsh/odsh_spatial_query' %}
\ No newline at end of file
diff --git a/ckanext/odsh/templates/snippets/package_item.html b/ckanext/odsh/templates/snippets/package_item.html
index 6586f137..1fedc587 100644
--- a/ckanext/odsh/templates/snippets/package_item.html
+++ b/ckanext/odsh/templates/snippets/package_item.html
@@ -67,7 +67,7 @@ Example:
             {% endif %}
             {% endblock heading_private %}
             {% block heading_title %}
-            {{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name),title=_('View {organization_name}').format(organization_name=title))}}
+            {{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='dataset', action='read', id=package.name),title=_('View {organization_name}').format(organization_name=title))}}
             {% endblock heading_title %}
             {% block heading_meta %}
             {% if package.get('state', '').startswith('draft') %}
@@ -120,7 +120,7 @@ Example:
       {% block resources_inner %}
       {% for resource in h.dict_list_reduce(package.resources, 'format') %}
       <li>
-        <a href="{{ h.url_for(controller='package', action='read', id=package.name) }}" class="label dataformat-label"
+        <a href="{{ h.url_for(controller='dataset', action='read', id=package.name) }}" class="label dataformat-label"
           data-format="{{ resource.lower().replace('_srvc','') }}">{{
           resource.replace('_SRVC','') }}</a>
       </li>
diff --git a/ckanext/odsh/templates/snippets/search_form.html b/ckanext/odsh/templates/snippets/search_form.html
index b0a7b0c1..ea5be0b8 100644
--- a/ckanext/odsh/templates/snippets/search_form.html
+++ b/ckanext/odsh/templates/snippets/search_form.html
@@ -42,7 +42,7 @@
     {% else %}
     <h2>{% snippet 'snippets/search_result_text.html', query=query, count=count, type=type %}</h2>
     {% if type == 'dataset' %}
-    <a aria-label="{{ _('rss feeds') }}" href={{h.remove_url_param([''], controller='feed', action='custom') }}> 
+    <a aria-label="{{ _('rss feeds') }}" href={{h.remove_url_param([''], controller='feeds', action='custom') }}> 
         <i aria-hidden="true" class="fa fa-medium fa-rss"></i>
     </a>
     {%- endif -%}
diff --git a/ckanext/odsh/templates/user/edit_user_form.html b/ckanext/odsh/templates/user/edit_user_form.html
index 9ceda7c7..3f1c396e 100644
--- a/ckanext/odsh/templates/user/edit_user_form.html
+++ b/ckanext/odsh/templates/user/edit_user_form.html
@@ -1,5 +1,4 @@
 {% import 'macros/form.html' as form %}
-{% resource 'odsh/tpsh_validate_password.js' %}
 
 
 <form id="user-edit-form" class="dataset-form form-horizontal" method="post" action="{{ action }}">
@@ -56,4 +55,4 @@
     {{ form.required_message() }}
     <button class="btn btn-primary" type="submit" name="save">{{ _('Update Profile') }}</button>
   </div>
-</form>
\ No newline at end of file
+</form>
diff --git a/ckanext/odsh/tests/test_routes.py b/ckanext/odsh/tests/test_routes.py
index 00c404d8..3ea06196 100644
--- a/ckanext/odsh/tests/test_routes.py
+++ b/ckanext/odsh/tests/test_routes.py
@@ -36,7 +36,7 @@ class TestRoutes:
     def _get_package_new_form(self):
         # self.env = {'REMOTE_USER': 'ckanuser'}
         response = self.app.get(
-            url=url_for(controller='package', action='new')
+            url=url_for(controller='dataset', action='new')
             # extra_environ=self.env,
         )
         return response.forms['dataset-edit']
diff --git a/ckanext/odsh/tests/test_search.py b/ckanext/odsh/tests/test_search.py
index 582c3605..3bcfc220 100644
--- a/ckanext/odsh/tests/test_search.py
+++ b/ckanext/odsh/tests/test_search.py
@@ -247,7 +247,7 @@ class TestSearch(helpers.FunctionalTestBase):
         return helpers.webtest_submit(search_form)
 
     def _perform_search_for_form(self, form):
-        search_url = url_for(controller='package', action='search')
+        search_url = url_for(controller='dataset', action='search')
         search_response = self._get_test_app().get(search_url)
 
         search_form = search_response.forms[form]
diff --git a/ckanext/odsh/tests/test_upload.py b/ckanext/odsh/tests/test_upload.py
index 53db2eea..662010b4 100644
--- a/ckanext/odsh/tests/test_upload.py
+++ b/ckanext/odsh/tests/test_upload.py
@@ -238,7 +238,7 @@ class TestUpload(helpers.FunctionalTestBase):
         )
         self.env = {'REMOTE_USER': user['name'].encode('ascii')}
         response = app.get(
-            url=url_for(controller='package', action='new'),
+            url=url_for(controller='dataset', action='new'),
             extra_environ=self.env,
         )
         return response.forms['dataset-edit']
@@ -247,7 +247,7 @@ class TestUpload(helpers.FunctionalTestBase):
         app = self._get_test_app()
         # user = factories.User()
         response = app.get(
-            url=url_for(controller='package', action='edit', id=id),
+            url=url_for(controller='dataset', action='edit', id=id),
             extra_environ=self.env,
         )
         return response.forms['dataset-edit']
@@ -256,7 +256,7 @@ class TestUpload(helpers.FunctionalTestBase):
         app = self._get_test_app()
         # user = factories.User()
         response = app.get(
-            url=url_for(controller='package', action='read', id=id),
+            url=url_for(controller='dataset', action='read', id=id),
             extra_environ=self.env,
         )
         return response
diff --git a/requirements.txt b/requirements.txt
index 524de62f..e7fd5b36 100755
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,6 +5,5 @@ lxml
 piwikapi
 multiline-log-formatter
 filehash==0.1.dev3
-pdf2image==1.9.0
+pdf2image
 pathlib
-pdftotext
-- 
GitLab