diff --git a/ckanext/odsh/collection/helpers.py b/ckanext/odsh/collection/helpers.py index ce519e6886ee88b9bf8fba51053cac8e3e4771bb..f905e15e766a203a455a97b4d578e7ed419d54f4 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='dataset', action='read', id=package_id) + return helpers.url_for(named_route='dataset.read', id=package_id) def url_last_member(name_collection): return toolkit.url_for('odsh_collection.latest_dataset', id=name_collection) diff --git a/ckanext/odsh/collection/plugin.py b/ckanext/odsh/collection/plugin.py index 0c8ccf0add71d68aa6a42eda97df4b4c8ecd8028..6b196f12b190271b9e49a4cd699507de70b2ce24 100644 --- a/ckanext/odsh/collection/plugin.py +++ b/ckanext/odsh/collection/plugin.py @@ -64,8 +64,7 @@ class CollectionsPlugin(plugins.SingletonPlugin, DefaultDatasetForm): if toolkit.is_url(pre_resource_url): url_resource = pre_resource_url else: - url_resource = toolkit.url_for(controller='dataset', - action='resource_download', + url_resource = toolkit.url_for(named_route='dataset.resource_download', id=download_package_id, resource_id=download_resource_id, filename=pre_resource_url) diff --git a/ckanext/odsh/helpers.py b/ckanext/odsh/helpers.py index 044e879ffec5d751603ffde9f6766369addb5d6d..79cd564ac8669fed8753299c65dc0a3fd28eb04f 100644 --- a/ckanext/odsh/helpers.py +++ b/ckanext/odsh/helpers.py @@ -428,7 +428,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='dataset', action='read', id=name) + helpers.url_for(named_route='dataset.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 c70ce0f3b6a1df64e8e41189130e141383967a4a..38fb986dbcaa0ffa150430a696d53cc8e45e4cf2 100644 --- a/ckanext/odsh/helpers_tpsh.py +++ b/ckanext/odsh/helpers_tpsh.py @@ -185,7 +185,7 @@ def get_address_org(organization): def get_body_mail(organization, package): package_name = package.get('name') - url = helpers.url_for(controller='dataset', action='read', id=package_name, qualified = True) + url = helpers.url_for(named_route='dataset.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 33409443b0988f27b5e6bf00cf60fdcf323d2e84..82a5d15cdc6cfe3f700bf756579cdb11591fcddd 100644 --- a/ckanext/odsh/pdf_to_thumbnail/helpers.py +++ b/ckanext/odsh/pdf_to_thumbnail/helpers.py @@ -16,8 +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='dataset', - action='resource_download', + url_resource = url_for(named_route='dataset.resource_download', id=package_id, resource_id=resource_id, filename=pre_resource_url, diff --git a/ckanext/odsh/profiles/odsh_dcat_de_profile.py b/ckanext/odsh/profiles/odsh_dcat_de_profile.py index e890e76330e433d12f512368f3026aa7a51a3603..98e8380e87ddb6441adc695c7b050d37f927cb7f 100644 --- a/ckanext/odsh/profiles/odsh_dcat_de_profile.py +++ b/ckanext/odsh/profiles/odsh_dcat_de_profile.py @@ -192,7 +192,7 @@ class ODSHDCATdeProfile(DCATdeProfile): @staticmethod def _construct_refs(id): public_url = config.get('ckan.site_url') - url_to_id = helpers.url_for(controller='dataset', action='read', id=id) + url_to_id = helpers.url_for(named_route='dataset.read', id=id) ref = public_url + url_to_id return ref diff --git a/ckanext/odsh/templates/datarequests/base.html b/ckanext/odsh/templates/datarequests/base.html index 933720ee2ab6955c0a43a86ed7e18840ec89e637..5722356efbd3f3694eac9923b5566e5206a4495c 100644 --- a/ckanext/odsh/templates/datarequests/base.html +++ b/ckanext/odsh/templates/datarequests/base.html @@ -9,7 +9,7 @@ {% endblock %} {% block breadcrumb_content %} - <li class="active">{% link_for _('Data Proposal'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='index' %}</li> + <li class="active">{% link_for _('Data Proposal'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> {% endblock %} {% block main_content %} diff --git a/ckanext/odsh/templates/datarequests/close.html b/ckanext/odsh/templates/datarequests/close.html index 65d168a68f2e43c4ec8c3eb5046e61a02d07ac7b..0b3e115cbf58638e539abd37db0ecf5c9f55b6d1 100644 --- a/ckanext/odsh/templates/datarequests/close.html +++ b/ckanext/odsh/templates/datarequests/close.html @@ -3,8 +3,8 @@ {% block subtitle %}{{ _('Close Data Proposal') }}{% endblock %} {% block breadcrumb_content %} - <li>{% link_for _('Data Proposal'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='index' %}</li> - <li>{% link_for c.datarequest.get('title')|truncate(30), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='show', id=c.datarequest.get('id') %}</li> + <li>{% link_for _('Data Proposal'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> + <li>{% link_for c.datarequest.get('title')|truncate(30), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.show', id=c.datarequest.get('id') %}</li> <li class="active"><a href="">{{ _('Close Data Proposal') }}</a></li> {% endblock %} diff --git a/ckanext/odsh/templates/datarequests/comment.html b/ckanext/odsh/templates/datarequests/comment.html index d64bfa830ed6e36e76e8c776b54c920a7da6c6d2..01d29f12799717317f242578188f9e3e1c7995ca 100644 --- a/ckanext/odsh/templates/datarequests/comment.html +++ b/ckanext/odsh/templates/datarequests/comment.html @@ -15,11 +15,11 @@ {% block primary_content_inner %} {% if h.check_access('update_datarequest', {'id':datarequest_id }) %} - {% link_for _('Manage'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='update', id=datarequest_id, class_='btn btn-default', icon='wrench' %} + {% link_for _('Manage'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.update', id=datarequest_id, class_='btn btn-default', icon='wrench' %} {% endif %} {% if h.check_access('close_datarequest', {'id':datarequest_id }) and not c.datarequest.closed %} - {% link_for _('Close'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='close', id=datarequest_id, class_='btn btn-danger', icon='lock' %} + {% link_for _('Close'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.close', id=datarequest_id, class_='btn btn-danger', icon='lock' %} {% endif %} <h2 class="page-heading"> @@ -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='dataset', action='read', id=c.datarequest.accepted_dataset.get('id') %} + {% link_for c.datarequest.accepted_dataset['title'], named_route='dataset.read', id=c.datarequest.accepted_dataset.get('id') %} {% else %} {{ _('None') }} {% endif %} diff --git a/ckanext/odsh/templates/datarequests/edit.html b/ckanext/odsh/templates/datarequests/edit.html index 6ca7fb6681ad5547c8db6a683489c50a14422885..ae3013703449b03a41d4687384428d435650967d 100644 --- a/ckanext/odsh/templates/datarequests/edit.html +++ b/ckanext/odsh/templates/datarequests/edit.html @@ -3,8 +3,8 @@ {% block subtitle %}{{ _('Edit Data Proposal') }}{% endblock %} {% block breadcrumb_content %} - <li>{% link_for _('Data Proposal'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='index' %}</li> - <li>{% link_for c.original_title|truncate(30), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='show', id=c.datarequest.get('id') %}</li> + <li>{% link_for _('Data Proposal'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> + <li>{% link_for c.original_title|truncate(30), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.show', id=c.datarequest.get('id') %}</li> <li class="active"><a href="">{{ _('Edit Data Proposal') }}</a></li> {% endblock %} diff --git a/ckanext/odsh/templates/datarequests/index.html b/ckanext/odsh/templates/datarequests/index.html index 947e326e3b1a621ad9ca338f949d442ff3286adc..d44ea2180a4c6d2e3803d0a26c76d6ce65a6b2ed 100644 --- a/ckanext/odsh/templates/datarequests/index.html +++ b/ckanext/odsh/templates/datarequests/index.html @@ -9,7 +9,7 @@ {{ h.snippet('datarequests/snippets/datarequest_list.html', datarequest_count=c.datarequest_count, datarequests=c.datarequests, page=c.page, q=c.q)}} {% if h.check_access('create_datarequest') %} <div class="add_request_container"> - {% link_for _('Add Request'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='new', class_='btn btn-primary', icon=h.get_plus_icon() %} + {% link_for _('Add Request'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.new', class_='btn btn-primary', icon=h.get_plus_icon() %} </div> {% endif %} {% endblock %} diff --git a/ckanext/odsh/templates/datarequests/new.html b/ckanext/odsh/templates/datarequests/new.html index e8f5807d55b31ecaf67cff57ef77ee4b785fa103..1cf63c2e0c15eaecc5cb421a741dde40f846957b 100644 --- a/ckanext/odsh/templates/datarequests/new.html +++ b/ckanext/odsh/templates/datarequests/new.html @@ -3,7 +3,7 @@ {% block subtitle %}{{ _('Create Data Request') }}{% endblock %} {% block breadcrumb_content %} - <li>{% link_for _('Data Proposal'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='index' %}</li> + <li>{% link_for _('Data Proposal'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.index' %}</li> <li class="active"><a href="">{{ _('Create Data Proposal') }}</a></li> {% endblock %} diff --git a/ckanext/odsh/templates/datarequests/show.html b/ckanext/odsh/templates/datarequests/show.html index 72eba0b5b1393d6fa0c575c4d2a78640b379577b..9ac6e9bf7ea0b94f1d7db7d07cbbd4b2722235a1 100644 --- a/ckanext/odsh/templates/datarequests/show.html +++ b/ckanext/odsh/templates/datarequests/show.html @@ -5,18 +5,18 @@ {% set datarequest_id = c.datarequest.get('id') %} {% block breadcrumb_content %} - <li>{% link_for _('Data Requests'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='index' %}</li> - <li>{% link_for c.datarequest.get('title'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='show', id=datarequest_id %}</li> + <li>{% link_for _('Data Requests'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI'.index' %}</li> + <li>{% link_for c.datarequest.get('title'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.show', id=datarequest_id %}</li> {% endblock %} {% block content_action %} {% if h.check_access('update_datarequest', {'id':datarequest_id }) %} - {% link_for _('Manage'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='update', id=datarequest_id, class_='btn btn-default', icon='wrench' %} + {% link_for _('Manage'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.update', id=datarequest_id, class_='btn btn-default', icon='wrench' %} {% endif %} {% if h.check_access('close_datarequest', {'id':datarequest_id }) and not c.datarequest.closed %} - {% link_for _('Close'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='close', id=datarequest_id, class_='btn btn-danger', icon='lock' %} + {% link_for _('Close'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.close', id=datarequest_id, class_='btn btn-danger', icon='lock' %} {% endif %} {% endblock %} diff --git a/ckanext/odsh/templates/datarequests/snippets/comment_item.html b/ckanext/odsh/templates/datarequests/snippets/comment_item.html index 155e6d1d624c87095d1b9203ccaf8ce7423a292b..678afe85203c6dd8c6ba13b6f4cdd3ce2435c7ec 100644 --- a/ckanext/odsh/templates/datarequests/snippets/comment_item.html +++ b/ckanext/odsh/templates/datarequests/snippets/comment_item.html @@ -6,7 +6,7 @@ {% endif %} <div class="odsh-comment-wrapper"> - {# <a href="{{ h.url_for(controller='user', action='read', id=comment.user.get('name')) }}" + {# <a href="{{ h.url_for(named_route='user.read', id=comment.user.get('name')) }}" class="comment-avatar"> {{ h.gravatar(comment.user.get('email_hash'), 48) }} </a> @@ -18,7 +18,7 @@ {% if h.check_access('delete_datarequest_comment', {'id':comment.id }) %} <div class="comment-action"> {% set locale = h.dump_json({'content': _('Are you sure you want to delete this comment?')}) %} - <a class="subtle-btn" id="delete-comment-{{ comment.id }}" href="{% url_for controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='delete_comment', datarequest_id=datarequest.id, comment_id=comment.id %}" data-module="confirm-action" data-module-i18n="{{ locale }}"><i class="icon-remove fa fa-times"></i></a> + <a class="subtle-btn" id="delete-comment-{{ comment.id }}" href="{% url_for named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.delete_comment', datarequest_id=datarequest.id, comment_id=comment.id %}" data-module="confirm-action" data-module-i18n="{{ locale }}"><i class="icon-remove fa fa-times"></i></a> </div> {% endif %} {% if can_update %} @@ -29,7 +29,7 @@ #} <div class="comment-header-text"> <i class="icon-comment fa fa-comment"></i> - <a href="{{ h.url_for(controller='user', action='read', id=comment.user.get('name')) }}" class="comment-author">{{ comment.user.get('display_name') }}</a> + <a href="{{ h.url_for(named_route='user.read', id=comment.user.get('name')) }}" class="comment-author">{{ comment.user.get('display_name') }}</a> <span class='comment-date' title="{{comment.time}}">{{ h.odsh_render_datetime(comment.time).lower() }}</span> </div> </div> diff --git a/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html b/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html index 9bebd010423455b00b0e56874bd835d13c3af9ce..df6950743b3bf03b962e5705e1b9290b54b39585 100644 --- a/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html +++ b/ckanext/odsh/templates/datarequests/snippets/datarequest_form.html @@ -27,7 +27,7 @@ then itself be extended to add/remove blocks of functionality. #} {% block delete_button %} {% if h.check_access('delete_datarequest', {'id': data.get('id', '')}) and not data.state == 'deleted' %} {% set locale = h.dump_json({'content': _('Are you sure you want to delete this data request?')}) %} - <a class="btn btn-danger pull-left" href="{% url_for controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='delete', id=data.get('id') %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a> + <a class="btn btn-danger pull-left" href="{% url_for named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.delete', id=data.get('id') %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a> {% endif %} {% endblock %} <button class="btn btn-primary btn-arrow-right" type="submit" name="save">{% block save_button_text %}{{ _('Create Data Request') }}{% endblock %}</button> diff --git a/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html b/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html index 90c75c19d0010ca1161fdf439a029ddbb09c0b85..c2ef8dac56cfa3121bc8f3eb1bd836bc3133fb3f 100644 --- a/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html +++ b/ckanext/odsh/templates/datarequests/snippets/datarequest_list.html @@ -10,7 +10,7 @@ <p class="empty"> {{ _('No Data Requests found with the given criteria') }}. {% if h.check_access('create_datarequest') %} - {% link_for _('How about creating one?'), controller='ckanext.datarequests.controllers.ui_controller:DataRequestsUI', action='new' %}</a> + {% link_for _('How about creating one?'), named_route='ckanext.datarequests.controllers.ui_controller:DataRequestsUI.new' %}</a> {% endif %} </p> {% endif %} diff --git a/ckanext/odsh/templates/header.html b/ckanext/odsh/templates/header.html index 123cdcb8507d025dc35df3acdfc6a4cb972999de..708d0a572b31f637fe6276466cdb759b2c8d3dc1 100644 --- a/ckanext/odsh/templates/header.html +++ b/ckanext/odsh/templates/header.html @@ -1,128 +1,121 @@ - {% block scripts %} - {% asset 'ckanext-odsh/tpsh_toggle_menu' %} +{% asset 'ckanext-odsh/tpsh_toggle_menu' %} {% endblock scripts %} {% block header_wrapper %} {% block header_account %} <header class="navbar navbar-static-top masthead"> - {% block header_debug %} - {% if g.debug and not g.debug_supress_header %} - <div class="debug">Controller : {{ c.controller }}<br />Action : {{ c.action }}</div> - {% endif %} - {% endblock %} - <div class="container"> - {# The .header-image class hides the main text and uses image replacement for the title #} - <div class='row topline'> + <div class="container"> + {# The .header-image class hides the main text and uses image replacement for the title #} + <div class='row topline'> - <div class='span3 span-navigation'> - <hgroup class="{{ g.header_class }} pull-left"> + <div class='span3 span-navigation'> + <hgroup class="{{ g.header_class }} pull-left"> - {% block header_logo %} - <a class="logo" href="{{ h.url_for('home') }}"> - <img class="img-logo-large" src="{{ h.url_for_static_or_external(g.site_logo) }}" alt="Logo Schleswig Holstein" - title="{{ g.site_title }}" /> - <img class="img-logo-small" src="/base/images/logo-quer.png" alt="Logo Schleswig Holstein" - title="{{ g.site_title }}" /> - </a> - {% endblock %} - </hgroup> - </div> - <h1 class='site-title'> {{ g.site_title }} </h1> - </div> - <div id="menu-button-and-title" data-module="tpsh_toggle_menu"> - <span class="fa fa-bars"></span> - <h1 class='site-title-mobile'> {{ g.site_title }} </h1> - </div> + {% block header_logo %} + <a class="logo" href="{{ h.url_for('home.index') }}"> + <img class="img-logo-large" src="{{ h.url_for_static_or_external(g.site_logo) }}" + alt="Logo Schleswig Holstein" title="{{ g.site_title }}" /> + <img class="img-logo-small" src="/base/images/logo-quer.png" alt="Logo Schleswig Holstein" + title="{{ g.site_title }}" /> + </a> + {% endblock %} + </hgroup> + </div> + <h1 class='site-title'> {{ g.site_title }} </h1> + </div> + <div id="menu-button-and-title" data-module="tpsh_toggle_menu"> + <span class="fa fa-bars"></span> + <h1 class='site-title-mobile'> {{ g.site_title }} </h1> </div> + </div> - <div class="container navigation-container"> - <div class='row navigation-row'> - <nav class="section navigation"> - <ul class="nav nav-pills"> - <li class="header-menu-mobile" data-module="tpsh_toggle_menu"> - <a>{{ _('Menu') }}</a> - <img src="/base/images/icon_close_white.svg" alt="Menü schließen" aria-label="Menü schließen"/> - </li> - {% block header_site_navigation_tabs %} - {{ - h.build_nav_main( - ('search', _('Datasets')), - ('organizations_index', _('Organizations')) - ) - }} - {% endblock %} - <li><a href="/infos">{{ _('Infos') }}</a></li> - {% set clazz='active' if c.action=='login' else ''%} - {% if h.check_access('package_create') %} - <li class='{{clazz}}'> - <a href="/harvest">{{ _('Harvester') }}</a> - </li> - <li class='{{clazz}}'> - {% link_for _('Upload'), controller='dataset', action='new', class_='text' %} - </li> - {% endif %} - {% if c.userobj %} - <li class="dropdown navbar-right {{clazz}}"> - {% set name = c.userobj.fullname if c.userobj.fullname else c.userobj.email%} - <a class="dropdown-toggle" data-toggle="dropdown" href="#"> - <svg class='user-icon' viewBox="0 0 54 54"> - <circle class='user-icon' cx="27" cy="17" r="7.5" /> - <path class='user-icon' - d="M42.5,44.5h-31v-6.4c0-4.7,3.9-8.6,8.6-8.6h13.9c4.7,0,8.6,3.9,8.6,8.6V44.5z" /> - </svg> - {{name}}</a> - <ul class="dropdown-menu" role="menu"> - <li> - <svg class='user-icon-small' viewBox="0 0 54 54"> - <circle cx="27" cy="17" r="7.5" /> - <path - d="M42.5,44.5h-31v-6.4c0-4.7,3.9-8.6,8.6-8.6h13.9c4.7,0,8.6,3.9,8.6,8.6V44.5z" /> - </svg> - <a href="{{ h.url_for('/user/') }}" title="logout" role="menuitem"> - <span class="text"> - {{ _('View profile') }} - </span> - </a> - </li> - <li> - <a href="{{ h.url_for('/user/edit') }}" title="logout" role="menuitem"> - <i class='fa fa-edit'></i> - <span class="text"> - {{ _('Edit profile') }} - </span> - </a> - </li> - <li> - <a href="{{ h.url_for('/user/_logout') }}" title="logout" role="menuitem"> - <i class='fa fa-sign-out'></i> - <span class="text">{{ _('Logout') }}</span> - </a> - </li> - </ul> - </a> - </li> - {% else %} - <li class='{{clazz}}'> - <a href="{{ h.url_for('/user/login') }}" title="login"> - <span class="text">{{ _('Login') }}</span> - </a> - </li> - {% endif %} - <li class="language-switch"> - <a href="/gebaerdensprache" title="{{ _('Sign language') }}" class="navGebaerdensprache"></a> - </li> - <li class="language-switch"> - <a href="/leichtesprache" title="{{ _('Simple language') }}" class="navLeichteSprache"></a> - </li> - </ul> - </nav> - <nav class="section navigation"> - <ul class="nav nav-pills"> - </ul> - </nav> - {% endblock %} - </div> + <div class="container navigation-container"> + <div class='row navigation-row'> + <nav class="section navigation"> + <ul class="nav nav-pills"> + <li class="header-menu-mobile" data-module="tpsh_toggle_menu"> + <a>{{ _('Menu') }}</a> + <img src="/base/images/icon_close_white.svg" alt="Menü schließen" aria-label="Menü schließen" /> + </li> + {% block header_site_navigation_tabs %} + {{ + h.build_nav_main( + ('search', _('Datasets')), + ('organizations_index', _('Organizations')) + ) + }} + {% endblock %} + <li><a href="/infos">{{ _('Infos') }}</a></li> + {% set clazz='active' if c.action=='login' else ''%} + {% if h.check_access('package_create') %} + <li class='{{clazz}}'> + <a href="/harvest">{{ _('Harvester') }}</a> + </li> + <li class='{{clazz}}'> + {% link_for _('Upload'), named_route='dataset.new', class_='text' %} + </li> + {% endif %} + {% if c.userobj %} + <li class="dropdown navbar-right {{clazz}}"> + {% set name = c.userobj.fullname if c.userobj.fullname else c.userobj.email%} + <a class="dropdown-toggle" data-toggle="dropdown" href="#"> + <svg class='user-icon' viewBox="0 0 54 54"> + <circle class='user-icon' cx="27" cy="17" r="7.5" /> + <path class='user-icon' + d="M42.5,44.5h-31v-6.4c0-4.7,3.9-8.6,8.6-8.6h13.9c4.7,0,8.6,3.9,8.6,8.6V44.5z" /> + </svg> + {{name}}</a> + <ul class="dropdown-menu" role="menu"> + <li> + <svg class='user-icon-small' viewBox="0 0 54 54"> + <circle cx="27" cy="17" r="7.5" /> + <path d="M42.5,44.5h-31v-6.4c0-4.7,3.9-8.6,8.6-8.6h13.9c4.7,0,8.6,3.9,8.6,8.6V44.5z" /> + </svg> + <a href="{{ h.url_for('user.read', id=c.userobj.name) }}" title="logout" role="menuitem"> + <span class="text"> + {{ _('View profile') }} + </span> + </a> + </li> + <li> + <a href="{{ h.url_for('user.edit', id=c.userobj.name) }}" title="logout" role="menuitem"> + <i class='fa fa-edit'></i> + <span class="text"> + {{ _('Edit profile') }} + </span> + </a> + </li> + <li> + <a href="{{ h.url_for('user.logout') }}" title="logout" role="menuitem"> + <i class='fa fa-sign-out'></i> + <span class="text">{{ _('Logout') }}</span> + </a> + </li> + </ul> + </a> + </li> + {% else %} + <li class='{{clazz}}'> + <a href="{{ h.url_for('user.login') }}" title="login"> + <span class="text">{{ _('Login') }}</span> + </a> + </li> + {% endif %} + <li class="language-switch"> + <a href="/gebaerdensprache" title="{{ _('Sign language') }}" class="navGebaerdensprache"></a> + </li> + <li class="language-switch"> + <a href="/leichtesprache" title="{{ _('Simple language') }}" class="navLeichteSprache"></a> + </li> + </ul> + </nav> + <nav class="section navigation"> + <ul class="nav nav-pills"> + </ul> + </nav> + {% endblock %} </div> + </div> </header> -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/home/index.html b/ckanext/odsh/templates/home/index.html index bd5674025f4051cb6d57f6cdd61c0e41e4d37b50..ff5122b718a4b22956dd3bfd625e1b32a67e5b2c 100644 --- a/ckanext/odsh/templates/home/index.html +++ b/ckanext/odsh/templates/home/index.html @@ -4,7 +4,7 @@ {% block subtitle %}{{ _("Welcome") }}{% endblock %} {% block breadcrumb_content %} - <li class="active">{{ h.nav_link(_('Start'), controller='home', action='index') }}</li> + <li class="active">{{ h.nav_link(_('Start'), named_route='home.index') }}</li> {% endblock %} @@ -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='dataset', action='search',extras={'groups':group.id} ) %} + {% set href = h.add_url_param(named_route='dataset.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/index.html b/ckanext/odsh/templates/organization/index.html index 45009cd217b649b3d9f5b7b8fa47b6d1e955ce7c..58de4af2b1b784fc481bdcf01d5bb3dc277f5e6a 100644 --- a/ckanext/odsh/templates/organization/index.html +++ b/ckanext/odsh/templates/organization/index.html @@ -3,7 +3,7 @@ {% block subtitle %}{{ _('Organizations') }}{% endblock %} {% block breadcrumb_content %} -<li class="active">{% link_for _('Organizations'), controller='organization', action='index' %}</li> +<li class="active">{% link_for _('Organizations'), named_route='organization.index' %}</li> {% endblock %} {% block page_header %}{% endblock %} @@ -27,7 +27,7 @@ {% block primary %} <div class="primary organization"> {% if h.check_access('organization_create') %} - {% link_for _('Add Organization'), controller='organization', action='new', class_='btn btn-primary', + {% link_for _('Add Organization'), named_route='organization.new', class_='btn btn-primary', icon='plus-square' %} {% endif %} <h1 class="hide-heading">{% block page_heading %}{{ _('Organizations') }}{% endblock %}</h1> @@ -45,7 +45,7 @@ <p class="empty"> {{ _('There are currently no organizations for this site') }}. {% if h.check_access('organization_create') %} - {% link_for _('How about creating one?'), controller='organization', action='new' %}</a>. + {% link_for _('How about creating one?'), named_route='organization.new' %}</a>. {% endif %} </p> {% endif %} diff --git a/ckanext/odsh/templates/organization/read.html b/ckanext/odsh/templates/organization/read.html index 60d9e9c7e0f2ec7af292fbe457c9efc34d54b61f..7c842dee0bb448dd3d18b83f528672973035292c 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='dataset', action='new', group=c.group_dict.id, class_='btn btn-primary', +{% link_for _('Add dataset'), named_route='dataset.new', group=c.group_dict.id, class_='btn btn-primary', icon='plus-square' %} {% endif %} {% endblock %} diff --git a/ckanext/odsh/templates/organization/snippets/organization_form.html b/ckanext/odsh/templates/organization/snippets/organization_form.html index e074b30e43c85561dd4b636c1f440cf7c9529058..1c4e8b1e1e73bef3d525a8ea6776ce5e084fab0d 100644 --- a/ckanext/odsh/templates/organization/snippets/organization_form.html +++ b/ckanext/odsh/templates/organization/snippets/organization_form.html @@ -10,8 +10,8 @@ {{ form.input('title', label=_('Name'), id='field-name', placeholder=_('My Organization'), value=data.title, error=errors.title, classes=['control-full'], attrs=attrs) }} {# Perhaps these should be moved into the controller? #} - {% set prefix = h.url_for(controller='organization', action='read', id='') %} - {% set domain = h.url_for(controller='organization', action='read', id='', qualified=true) %} + {% set prefix = h.url_for(named_route='organization.read', id='') %} + {% set domain = h.url_for(named_route='organization.read', id='', qualified=true) %} {% set domain = domain|replace("http://", "")|replace("https://", "") %} {% set attrs = {'data-module': 'slug-preview-slug', 'data-module-prefix': domain, 'data-module-placeholder': '<organization>'} %} diff --git a/ckanext/odsh/templates/organization/snippets/organization_item.html b/ckanext/odsh/templates/organization/snippets/organization_item.html index 8bb15bc66b08812b17fe8160ab69f1aa91c52159..079c8ec8ab00f17bb703bdd8da8dbbabae760d31 100644 --- a/ckanext/odsh/templates/organization/snippets/organization_item.html +++ b/ckanext/odsh/templates/organization/snippets/organization_item.html @@ -11,7 +11,7 @@ Example: {% endfor %} </ul> #} -{% set url = h.url_for(controller='organization', action='read', id=organization.name) %} +{% set url = h.url_for(named_route='organization.read', id=organization.name) %} <a class="organization-item" href="{{ url }}" title="{{ _('View {organization_name}').format(organization_name=organization.display_name) }}"> <div class="row organization-item"> <div class="span1 organization-item-text"> diff --git a/ckanext/odsh/templates/package/base.html b/ckanext/odsh/templates/package/base.html index 63718cd3240e593c19bfe21776630fb09adf39c4..4cf8978b315f07db41da93a5f21836ececc1a9b7 100644 --- a/ckanext/odsh/templates/package/base.html +++ b/ckanext/odsh/templates/package/base.html @@ -11,15 +11,15 @@ {% set dataset = h.dataset_display_name(pkg) %} {% if pkg.organization %} {% set organization = h.get_translated(pkg.organization, 'title') or pkg.organization.name %} -<li>{% link_for _('Organizations'), controller='organization', action='index' %}</li> -<li>{% link_for organization|truncate(30), controller='organization', action='read', id=pkg.organization.name %}</li> +<li>{% link_for _('Organizations'), named_route='organization.index' %}</li> +<li>{% link_for organization|truncate(30), named_route='organization.read', id=pkg.organization.name %}</li> {% else %} -<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li> +<li>{% link_for _('Datasets'), named_route='dataset.search' %}</li> {% endif %} -<li {{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), controller='dataset', action='read', +<li {{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), named_route='dataset.read', id=pkg.name %}</li> {% else %} -<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li> +<li>{% link_for _('Datasets'), named_route='dataset.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 f383e6684f14f7937057b2ced0c9df770a2432b0..6b2b285b2b8353e74bdaa7bacbf454b10345e44e 100644 --- a/ckanext/odsh/templates/package/edit_base.html +++ b/ckanext/odsh/templates/package/edit_base.html @@ -4,7 +4,7 @@ {% block breadcrumb_content %} {% if pkg %} -<li class="active">{% link_for _('Edit'), controller='dataset', action='edit', id=pkg.name %}</li> +<li class="active">{% link_for _('Edit'), named_route='dataset.edit', id=pkg.name %}</li> {% else %} <li class="active"><a href="">{{ _('Create Dataset') }}</a></li> {% endif %} @@ -20,7 +20,7 @@ {% block primary_content %} <div class="odsh-dataset-heading"> <div class='title'>Datensatz "{{h.dataset_display_name(pkg)}}" bearbeiten</div> - {% link_for _('Back'), controller='dataset', action='read', id=pkg.name, class_='btn btn-heading', icon='arrow-left' %} + {% link_for _('Back'), named_route='dataset.read', id=pkg.name, class_='btn btn-heading', icon='arrow-left' %} <span class="clear"></span> </div> {{ super() }} diff --git a/ckanext/odsh/templates/package/read.html b/ckanext/odsh/templates/package/read.html index e62a2fab17cde0439202964703dcdfde3a87a77b..fd2de74b9dcc510100b91d4c8793659efd97c25b 100644 --- a/ckanext/odsh/templates/package/read.html +++ b/ckanext/odsh/templates/package/read.html @@ -14,14 +14,14 @@ {% set dataset = h.dataset_display_name(pkg) %} {% if pkg.organization %} {% 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> +<li>{% link_for organization|truncate(30), named_route='organization.read', id=pkg.organization.name %}</li> {% else %} -<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li> +<li>{% link_for _('Datasets'), named_route='dataset.search' %}</li> {% endif %} -<li {{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), controller='dataset', action='read', +<li {{ self.breadcrumb_content_selected() }}>{% link_for dataset|truncate(30), named_route='dataset.read', id=pkg.name %}</li> {% else %} -<li>{% link_for _('Datasets'), controller='dataset', action='search' %}</li> +<li>{% link_for _('Datasets'), named_route='dataset.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='dataset', action='edit', id=pkg.name, class_='btn btn-primary btn-add-dataset', + {% link_for _('Manage Dataset'), named_route='dataset.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='resource', action='new', id=c.pkg_dict.name, class_='btn btn-primary', icon='plus' %} + {% link_for _('Add new resource'), named_route='resource.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 f2c33fe49a3e2c4da22f60a5a8f03fff12ebb88b..4ada9a1e0e8d5d34d86c2e1b176e23c990651e17 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='resource', action='read', id=pkg.name, resource_id=res.id %}</li> + <li>{% link_for h.resource_display_name(res)|truncate(30), named_route='resource.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)%}"{{res.name}}"{%endif%} bearbeiten</span> - {% link_for _('Back'), controller='resource', action='read', id=pkg.name, resource_id=res.id, class_='btn btn-heading', icon='arrow-left' %} + {% link_for _('Back'), named_route='resource.read', id=pkg.name, resource_id=res.id, class_='btn btn-heading', icon='arrow-left' %} <span class="clear"></span> </div> {% endif %} diff --git a/ckanext/odsh/templates/package/resource_read.html b/ckanext/odsh/templates/package/resource_read.html index 3c11d74d7081d8b10659e07282efaf7017bf762e..758b2e15e23715c607bc40ff8087f2929213fb94 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='dataset', action='edit', id=pkg.name, resource_id=res.id, class_='btn', icon='wrench' %}</li> + <li>{% link_for _('Manage'), named_route='dataset.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 package.notes %} <h3>{{ _('From the dataset abstract') }}</h3> <blockquote>{{ h.markdown_extract(h.get_translated(package, 'notes')) }}</blockquote> - <p>{% trans dataset=package.title, url=h.url_for(controller='dataset', action='read', id=package['name']) %}Source: <a href="{{ url }}">{{ dataset }}</a>{% endtrans %} + <p>{% trans dataset=package.title, url=h.url_for(named_route='dataset.read', id=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 61e64b6521b1ebef9b26185b6d30bab7b880770d..5db3c32da90dfe70c468d4ad44e6ada1fd625398 100644 --- a/ckanext/odsh/templates/package/search.html +++ b/ckanext/odsh/templates/package/search.html @@ -7,12 +7,12 @@ {% endblock styles %} {% block breadcrumb_content %} - <li class="active">{{ h.nav_link(_('Datasets'), controller='dataset', action='search', highlight_actions = 'new index') }}</li> + <li class="active">{{ h.nav_link(_('Datasets'), named_route='dataset.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='dataset', action='search' %}" +<form id='dataset-search-box-form' class="section site-search simple-input" action="{% url_for named_route='dataset.search' %}" method="get" data-module="select-switch"> <div class="row filter-search-row"> <div class='btn show-filters'>{{ _("Filter") }}</div> @@ -50,7 +50,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='dataset', action='search')}}">{{ _('Reset') }}</a> + <a href="{{h.url_for(named_route='dataset.search')}}">{{ _('Reset') }}</a> </div> </div> </div> diff --git a/ckanext/odsh/templates/package/snippets/package_form.html b/ckanext/odsh/templates/package/snippets/package_form.html index ee6c6436c125f8a42ac5f0b065f3fc1bde685782..1b0c922627e28f1930a7bda41cf1eca696c975ac 100644 --- a/ckanext/odsh/templates/package/snippets/package_form.html +++ b/ckanext/odsh/templates/package/snippets/package_form.html @@ -28,7 +28,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='dataset', action='delete', id=data.id %}" + <a class="btn btn-danger pull-left" href="{% url_for named_route='dataset.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 0c196b9e87fd474dac95d6e0cdc390fd4d1f5651..ce2777904c0f7fac040e49a816262f3f26490592 100644 --- a/ckanext/odsh/templates/package/snippets/resource_form.html +++ b/ckanext/odsh/templates/package/snippets/resource_form.html @@ -3,7 +3,7 @@ {% set data = data or {} %} {% set errors = errors or {} %} {% set active = data and data.state=='active' %} -{% set action = form_action or h.url_for(controller='resource', action='new', id=pkg_name) %} +{% set action = form_action or h.url_for(named_route='resource.new', 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> {% block stages %} diff --git a/ckanext/odsh/templates/package/snippets/resource_item.html b/ckanext/odsh/templates/package/snippets/resource_item.html index 33c97155a501a2f37e465f5d82f67dd0d6da7360..9b65a49df81edc9fc5b507626a791ba5540e0953 100644 --- a/ckanext/odsh/templates/package/snippets/resource_item.html +++ b/ckanext/odsh/templates/package/snippets/resource_item.html @@ -1,5 +1,5 @@ {% 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) %} +{% set url = h.url_for(named_route='resource.'+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 %} @@ -30,7 +30,7 @@ <div aria-hidden="true" class="icon icon-download"></div> </a> {% if can_edit %} - <a href="{{ h.url_for(controller='resource', action='edit', id=pkg.name, resource_id=res.id) }}"> + <a href="{{ h.url_for(named_route='resource.edit', id=pkg.name, resource_id=res.id) }}"> <div class="icon icon-edit"></div> </a> {% endif %} @@ -52,7 +52,7 @@ <div aria-hidden="true" class="icon icon-download"></div> </a> {% if can_edit %} - <a href="{{ h.url_for(controller='resource', action='edit', id=pkg.name, resource_id=res.id) }}"> + <a href="{{ h.url_for(named_route='resource.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 c498d12d8389891f443ae7cd6bc9d7feeda71776..0a7378a5c0b30dabb0bee6c9443f32d5e43fad99 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='dataset', action='new', class_="highlight" %} + {% link_for _('Add dataset'), named_route='dataset.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 ed445941b921f2615ea429b4b102ed4288ef6cad..822af31031768f5b2cfb1377a0800a4c60dcf7c6 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='resource', action='views', id=pkg.name, resource_id=res.id, class_='btn', icon='arrow-left' %} + {% link_for _('All views'), named_route='resource.views', id=pkg.name, resource_id=res.id, class_='btn', icon='arrow-left' %} {% if res %} - {% set url = h.url_for(controller='resource', action='read', id=pkg.name, resource_id=res.id) ~ '?view_id=' ~ resource_view.id %} + {% set url = h.url_for(named_route='resource.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/snippets/follow_button.html b/ckanext/odsh/templates/snippets/follow_button.html index 4085eff5c46b6379b179c3c2cf54dc897e06a33b..918b23c784068dc8344cf8952ce294b6cc76f495 100644 --- a/ckanext/odsh/templates/snippets/follow_button.html +++ b/ckanext/odsh/templates/snippets/follow_button.html @@ -4,12 +4,12 @@ {% endif %} {% if following %} -<a href="{{ h.url_for(controller=controller, action='unfollow', id=obj_id) }}" class="{% block following_class %}btn btn-primary{% endblock %}" +<a href="{{ h.url_for(obj_type + '.unfollow', id=obj_id) }}" class="{% block following_class %}btn btn-primary{% endblock %}" data-module="follow" data-module-type="{{ obj_type }}" data-module-id="{{ obj_id }}" data-module-action="unfollow"> {{ _('Unfollow') }} </a> {% else %} -<a href="{{ h.url_for(controller=controller, action='follow', id=obj_id) }}" class="{% block unfollowing_class %}btn btn-primary {% endblock %}" +<a href="{{ h.url_for(obj_type + '.follow', id=obj_id) }}" class="{% block unfollowing_class %}btn btn-primary {% endblock %}" data-module="follow" data-module-type="{{ obj_type }}" data-module-id="{{ obj_id }}" data-module-action="follow"> {{ _('Follow') }} </a> diff --git a/ckanext/odsh/templates/snippets/organization.html b/ckanext/odsh/templates/snippets/organization.html index d24457c081a44c19fa40d172e74e47ae12613b39..3465d5cd16a241ea896ad76ae02db4a96479c4af 100644 --- a/ckanext/odsh/templates/snippets/organization.html +++ b/ckanext/odsh/templates/snippets/organization.html @@ -84,7 +84,7 @@ Example: {% if organization.description %} <p> {{ h.markdown_extract(organization.description, 180) }} - {% link_for _('read more'), controller='organization', action='about', id=organization.name %} + {% link_for _('read more'), named_route='organization.about', id=organization.name %} </p> {% else %} <p class="empty">{{ _('There is no description for this organization') }}</p> diff --git a/ckanext/odsh/templates/snippets/package_item.html b/ckanext/odsh/templates/snippets/package_item.html index 5c85b2aaf1a7149e15613be87e459212d45344cb..5229397894ab89416f0c6819a873c994cc750dc1 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='dataset', action='read', id=package.name),title=_('View {organization_name}').format(organization_name=title))}} + {{ h.link_to(h.truncate(title, truncate_title), h.url_for(named_route='dataset.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='dataset', action='read', id=package.name) }}" class="label dataformat-label" + <a href="{{ h.url_for(named_route='dataset.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 09b45a2367039960fc17adf5ae164d46366cf7aa..ffd38b0997b187c2bc1f8ec351f1e8928b8f88b2 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='feeds', action='custom') }}> + <a aria-label="{{ _('rss feeds') }}" href={{h.remove_url_param([''], named_route='feeds.custom') }}> <i aria-hidden="true" class="fa fa-solid fa-rss"></i> </a> {%- endif -%} diff --git a/ckanext/odsh/templates/user/login.html b/ckanext/odsh/templates/user/login.html index e1c8498863067f170cccfed8e092d95ad0d50734..3167301e06eb2531bc4436541c473dc996e888ab 100644 --- a/ckanext/odsh/templates/user/login.html +++ b/ckanext/odsh/templates/user/login.html @@ -7,31 +7,31 @@ {% endblock skip %} {% block breadcrumb_content %} -<li class="active">{{ h.nav_link(_('Login'), controller='user', action='login') }}</li> + <li class="active">{{ h.nav_link(_('Login'), named_route='user.login') }}</li> {% endblock %} {% block primary_content %} -<section class="module"> + <section class="module"> <div class="module-content"> - <h2 class="page-heading">{% block page_heading %}{{ _('Login') }}{% endblock %}</h2> - {% block form %} - {% snippet "user/snippets/login_form.html", action=c.login_handler, error_summary=error_summary %} - {% endblock %} + <h2 class="page-heading">{% block page_heading %}{{ _('Login') }}{% endblock %}</h2> + {% block form %} + {% snippet "user/snippets/login_form.html", error_summary=error_summary %} + {% endblock %} </div> -</section> -{% endblock %} + </section> + {% endblock %} -{% block secondary_content %} + {% block secondary_content %} -{% block help_forgotten %} -<section class="module module-narrow module-shallow"> - {% block help_forgotten_inner %} - <span>{{ _('Forgotten your password?') }}:</span> - {% block help_forgotten_button %} - <a class="btn-forget-password" href="{{ h.url_for(controller='user', action='request_reset') }}"> - {{ _('Change password') }}</a> - {% endblock %} - {% endblock %} -</section> -{% endblock %} -{% endblock %} + {% block help_forgotten %} + <section class="module module-narrow module-shallow"> + {% block help_forgotten_inner %} + <span>{{ _('Forgotten your password?') }}:</span> + {% block help_forgotten_button %} + <a class="btn-forget-password" href="{{ h.url_for(user.request_reset) }}"> + {{ _('Change password') }}</a> + {% endblock %} + {% endblock %} + </section> + {% endblock %} +{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/user/logout.html b/ckanext/odsh/templates/user/logout.html index 50d38b0649901047d0432527c6a6ae54673af4de..3328f459278f15e92750cca4311c5215993c3526 100644 --- a/ckanext/odsh/templates/user/logout.html +++ b/ckanext/odsh/templates/user/logout.html @@ -1,7 +1,7 @@ {% extends "page.html" %} {% block breadcrumb_content %} - <li class="active">{{ h.nav_link(_('Logout'), controller='user', action='logout') }}</li> + <li class="active">{{ h.nav_link(_('Logout'), named_route='user.logout') }}</li> {% endblock %} {% block subtitle %}{{ _('Logged Out') }}{% endblock %} diff --git a/ckanext/odsh/tests/test_routes.py b/ckanext/odsh/tests/test_routes.py index 3ea06196116ebfc12b5ee2ab2797a2ff9623d394..59ddeffc288e9a8234008abce426339972ccb1d2 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='dataset', action='new') + url=url_for(named_route='dataset.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 5989e591a7cfd55ac5e024d1470c4d2695c2a178..854a7917a5f7a0c3a8e27ccafe1cae33f153f185 100644 --- a/ckanext/odsh/tests/test_search.py +++ b/ckanext/odsh/tests/test_search.py @@ -246,7 +246,7 @@ class TestSearch(helpers.FunctionalTestBase): return helpers.webtest_submit(search_form) def _perform_search_for_form(self, form): - search_url = url_for(controller='dataset', action='search') + search_url = url_for(named_route='dataset.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 206cb18dfd700c42d3463e9c2928efb4266247ec..50f54422253aa0e95f1192edbae121b6e32493da 100644 --- a/ckanext/odsh/tests/test_upload.py +++ b/ckanext/odsh/tests/test_upload.py @@ -237,7 +237,7 @@ class TestUpload(helpers.FunctionalTestBase): ) self.env = {'REMOTE_USER': user['name'].encode('ascii')} response = app.get( - url=url_for(controller='dataset', action='new'), + url=url_for(named_route='dataset.new'), extra_environ=self.env, ) return response.forms['dataset-edit'] @@ -246,7 +246,7 @@ class TestUpload(helpers.FunctionalTestBase): app = self._get_test_app() # user = factories.User() response = app.get( - url=url_for(controller='dataset', action='edit', id=id), + url=url_for(named_route='dataset.edit', id=id), extra_environ=self.env, ) return response.forms['dataset-edit'] @@ -255,7 +255,7 @@ class TestUpload(helpers.FunctionalTestBase): app = self._get_test_app() # user = factories.User() response = app.get( - url=url_for(controller='dataset', action='read', id=id), + url=url_for(named_route='dataset.read', id=id), extra_environ=self.env, ) return response diff --git a/ckanext/odsh/tests/test_user.py b/ckanext/odsh/tests/test_user.py index 18d14ac6307d1e6dd789ab1c9e7110da7fd5c791..5dede8b16bcd9e583c7f331335e97410fbd42b21 100644 --- a/ckanext/odsh/tests/test_user.py +++ b/ckanext/odsh/tests/test_user.py @@ -83,7 +83,7 @@ class TestUser(helpers.FunctionalTestBase): def _logout(self): app = self._get_test_app() - logout_url = url_for(controller='user', action='logout') + logout_url = url_for(named_route='user.logout') logout_response = app.get(logout_url, status=302) final_response = helpers.webtest_maybe_follow(logout_response) return final_response diff --git a/ckanext/odsh/views/feed.py b/ckanext/odsh/views/feed.py index 793c50ebec806ca022fe6dc0aaecc1d5801473ca..16e6947ee7e30014a3079265cee8e7410d811d99 100644 --- a/ckanext/odsh/views/feed.py +++ b/ckanext/odsh/views/feed.py @@ -44,12 +44,10 @@ def custom(): request.args, item_count=item_count, limit=data_dict['rows'], - controller=u'feeds', - action=u'custom') + named_route='feeds.custom') feed_url = ckan_feed._feed_url(request.args, - controller='feeds', - action='custom') + named_route='feeds.custom') atom_url = h._url_with_params('/feeds/custom.atom', list(search_params.items()))