refactor "package" to "dataset" per ckan 2.10

This commit is contained in:
Elia Bellavista 2024-05-08 16:14:24 +02:00
parent fb0dfe1f66
commit 617f551134
23 changed files with 39 additions and 38 deletions

View File

@ -16,7 +16,7 @@
{% for tag in formats %}
{% set weight = 30 - loop.index %}
<a href="{% url_for controller='package', action='search', res_format=tag.name %}" rel={{weight}}>{{ h.truncate(tag.display_name, 26) }}</a>
<a href="{% url_for controller='dataset', action='search', res_format=tag.name %}" rel={{weight}}>{{ h.truncate(tag.display_name, 26) }}</a>
{% endfor %}
</div>
</div>

View File

@ -15,7 +15,7 @@
<div id="pop-groups">
{% for group in groups %}
{% set weight = 30 - loop.index %}
<a href="{% url_for controller='package', action='search', groups=group.name %}" rel={{weight}}>{{ h.truncate(group.display_name, 26) }}</a>
<a href="{% url_for controller='dataset', action='search', groups=group.name %}" rel={{weight}}>{{ h.truncate(group.display_name, 26) }}</a>
{% endfor %}
</div>
</div>

View File

@ -19,7 +19,7 @@
<div id="pop-types">
{% for type in metadatatypes %}
{% set weight = 30 - loop.index %}
<a href="{% url_for controller='package', action='search', systemtype=type.name %}" rel={{weight}}>{{ h.truncate(type.display_name, 26) }}</a>
<a href="{% url_for controller='dataset', action='search', systemtype=type.name %}" rel={{weight}}>{{ h.truncate(type.display_name, 26) }}</a>
{% endfor %}
</div>
</div>

View File

@ -16,7 +16,7 @@
{% for tag in tags %}
{% set weight = 30 - loop.index %}
<a href="{% url_for controller='package', action='search', tags=tag.name %}" rel={{weight}}>{{ h.truncate(tag.display_name, 26) }}</a>
<a href="{% url_for controller='dataset', action='search', tags=tag.name %}" rel={{weight}}>{{ h.truncate(tag.display_name, 26) }}</a>
{% endfor %}
</div>
<p style="float: right; margin-bottom: 15px;">

View File

@ -2,7 +2,8 @@
{% set placeholder = _('Insert keywords here') %}
<div class="module module-search module-narrow module-shallow box">
<form class="module-content search-form" method="get" action="{% url_for controller='package', action='search' %}">
<!-- ckan 2.10 changed url_for controller=package to dataset-->
<form class="module-content search-form" method="get" action="{% url_for controller='dataset', action='search' %}">
<h3 class="heading">{{ _('Datasets') }} Search</h3>
<div class="search-input control-group search-giant">
<input type="text" class="search" name="q" value="" autocomplete="off" placeholder="{% block search_placeholder %}{{ placeholder }}{% endblock %}" />
@ -12,7 +13,7 @@
</button>
</div>
<div>
<a href="{{ h.url_for(controller='package', action='search') }}">See All {{ _('Datasets') }}</a>
<a href="{{ h.url_for(controller='dataset', action='search') }}">See All {{ _('Datasets') }}</a>
<a href="/tag" style="float: right;">See All {{ _('Tags') }}</a>
</div>
</form>

View File

@ -1,4 +1,4 @@
{% set alternative_url_dataset = h.url_for(controller='package', action='search') %}
{% set alternative_url_dataset = h.url_for(controller='dataset', action='search') %}
{% set locations = h.d4science_get_location_to_bboxes() %}
<div role="main" class="hero">
<div class="container">

View File

@ -15,7 +15,7 @@
{% endif %}
<td class="media-item-homepage">
{% set img_url = h.d4science_get_url_to_icon_for_ckan_entity(type.name, entity_type='type') %}
<a href="{% url_for controller='package', action='search', systemtype=type.name %}" title="{{ _('View {name}').format(name=type.name) }}">
<a href="{% url_for controller='dataset', action='search', systemtype=type.name %}" title="{{ _('View {name}').format(name=type.name) }}">
<img class="logo-homepage" src="{{ img_url }}" alt="{{ type.display_name }}" title="{{ _('{name}').format(name=type.display_name) }} group"/>
<p class="media-heading-homepage">
{{ h.truncate(type.display_name, 26) }}

View File

@ -8,7 +8,7 @@
<ul>
{% block stats_group %}
<li>
<a href="{{ h.url_for(controller='package', action='search') }}">
<a href="{{ h.url_for(controller='dataset', action='search') }}">
<b>{{ h.SI_number_span(stats.dataset_count) }}</b>
{{ _('dataset') if stats.dataset_count == 1 else _('datasets') }}
</a>

View File

@ -7,7 +7,7 @@
{% if hide=='true' %}
{# NOT SHOW 'Manage' #}
{% else %}
{% link_for _('Add Dataset'), controller='package', action='new', group=c.group_dict.id, class_='btn btn-primary', icon='plus-sign-alt' %}
{% link_for _('Add Dataset'), controller='dataset', action='new', group=c.group_dict.id, class_='btn btn-primary', icon='plus-sign-alt' %}
{% endif %}
{% endif %}
{% endblock %}

View File

@ -21,7 +21,7 @@
{% if hide=='true' %}
{# NOT SHOW 'Manage' #}
{% else %}
{% link_for _('Add Dataset'), controller='package', action='new', group=c.group_dict.id, class_='btn btn-primary', icon='plus-sign-alt' %}
{% link_for _('Add Dataset'), controller='dataset', action='new', group=c.group_dict.id, class_='btn btn-primary', icon='plus-sign-alt' %}
{% endif %}
{% endif %}
{% endblock %}

View File

@ -14,11 +14,11 @@
<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', id=pkg.name %}</li>
<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 %}

View File

@ -44,19 +44,19 @@ if(window.addEventListener){
{% set role_for_user = h.d4science_theme_get_user_role_for_group_or_org(pkg.organization.id, username_id) %}
{% if role_for_user %}
{% if role_for_user == 'admin' %}
{% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %}
{% link_for _('Manage'), controller='dataset', action='edit', id=pkg.name, class_='btn', icon='wrench' %}
{% else %}
{% if role_for_user == 'editor' %}
{# IF THE USER HAS ROLE EDITOR HE/SHE CAN EDIT ONLY ITS DATASET, see related ticket #5119 #}
{% if username_id == pkg_creator_user_id %}
{% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %}
{% link_for _('Manage'), controller='dataset', action='edit', id=pkg.name, class_='btn', icon='wrench' %}
{% endif %}
{% endif %}
{# NOT SHOW 'Manage' #}
{% endif %}
{% endif %}
{% else %}
{% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %}
{% link_for _('Manage'), controller='dataset', action='edit', id=pkg.name, class_='btn', icon='wrench' %}
{% endif %}
{% endif %}
{% endblock %}
@ -79,7 +79,7 @@ if(window.addEventListener){
<div class="module info alert alert-info">
<p class="module-content">
{% set timestamp = h.render_datetime(c.revision_date, with_hours=True) %}
{% set url = h.url_for(controller='package', action='read', id=pkg.name) %}
{% set url = h.url_for(controller='dataset', action='read', id=pkg.name) %}
{% trans timestamp=timestamp, url=url %}This is an old revision of this dataset, as edited at {{ timestamp }}. It may differ significantly from the <a href="{{ url }}">current revision</a>.{% endtrans %}
</p>

View File

@ -8,15 +8,15 @@
{% 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='dataset', action='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 %}
{% block content_action %}
{% link_for _('All resources'), controller='package', action='resources', id=pkg.name, class_='btn', icon='arrow-left' %}
{% link_for _('All resources'), controller='dataset', action='resources', id=pkg.name, class_='btn', icon='arrow-left' %}
{% if res %}
{% link_for _('View resource'), controller='package', action='resource_read', id=pkg.name, resource_id=res.id, class_='btn', icon='eye-open' %}
{% link_for _('View resource'), controller='dataset', action='resource_read', id=pkg.name, resource_id=res.id, class_='btn', icon='eye-open' %}
{% endif %}
{% endblock %}

View File

@ -36,7 +36,7 @@ function handleClick(event, element, url) {
<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='resource_edit', id=pkg.name, resource_id=res.id, class_='btn', icon='wrench' %}</li>
{% endif %}
{% if res.url and h.is_url(res.url) %}
<li>
@ -76,7 +76,7 @@ function handleClick(event, element, url) {
{% if not res.description and c.package.notes %}
<h3>{{ _('From the dataset abstract') }}</h3>
<blockquote>{{ h.d4science_theme_markdown_extract_html(c.package.get('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 %}

View File

@ -4,7 +4,7 @@
{% block subtitle %}{{ _("Datasets") }}{% endblock %}
{% 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 primary_content %}
@ -15,7 +15,7 @@
{# ADDED BY FRANCESCO MANGIACRAPA, 'ADD DATASET' IS SHOWN ONLY TO USER SYSADMIN' #7188 #}
{% if c.userobj and c.userobj.sysadmin %}
<div class="page_primary_action">
{% link_for _('Add Dataset'), controller='package', action='new', class_='btn btn-primary', icon='plus-sign-alt' %}
{% link_for _('Add Dataset'), controller='dataset', action='new', class_='btn btn-primary', icon='plus-sign-alt' %}
</div>
{% endif %}
{% endif %}

View File

@ -2,7 +2,7 @@
{% set data = data or {} %}
{% set errors = errors or {} %}
{% 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 form-horizontal" method="post" action="{{ action }}" data-module="basic-form resource-form" enctype="multipart/form-data" novalidate>
{% block stages %}
@ -73,7 +73,7 @@
{% if data.id %}
{% if h.check_access('resource_delete', {'id': data.id}) %}
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this resource?')}) %}
<a class="btn btn-danger pull-left" href="{% url_for controller='package', action='resource_delete', resource_id=data.id, id=pkg_name %}" 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 controller='dataset', action='resource_delete', resource_id=data.id, id=pkg_name %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
{% endif %}
{% endif %}
{% endblock %}

View File

@ -1,6 +1,6 @@
{% set can_edit = h.check_access('package_update', {'id':pkg.id }) %}
{% 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 = h.url_for(controller='dataset', action=url_action, id=pkg.name, resource_id=res.id) %}
<li class="resource-item" data-id="{{ res.id }}">
{# Added by Francesco Mangiacrapa block custom_view_on_resources see:4851 #}
{% block custom_view_on_resources %}
@ -66,7 +66,7 @@
{% endif %}
{#{% if can_edit %}#}
<li>
<a href="{{ h.url_for(controller='package', action='resource_edit', id=pkg.name, resource_id=res.id) }}">
<a href="{{ h.url_for(controller='dataset', action='resource_edit', id=pkg.name, resource_id=res.id) }}">
<i class="icon-edit"></i>
{{ _('Edit') }}
</a>

View File

@ -23,7 +23,7 @@ Example:
<ul class="unstyled nav nav-simple">
{% for resource in resources %}
<li title="{{ resource.name }}" class="nav-item{{ ' active' if active == resource.id }}">
{% link_for h.resource_display_name(resource)|truncate(25), controller='package', action=action or 'resource_read', id=pkg.name, resource_id=resource.id, inner_span=true %}
{% link_for h.resource_display_name(resource)|truncate(25), controller='dataset', action=action or 'resource_read', id=pkg.name, resource_id=resource.id, inner_span=true %}
</li>
{% endfor %}
</ul>

View File

@ -65,7 +65,7 @@ goToHomeLink = function (divId) {
</ul>
{% else %}
{% if h.check_access('resource_create', {'package_id': pkg['id']}) %}
{% trans url=h.url_for(controller='package', action='new_resource', id=pkg.name) %}
{% trans url=h.url_for(controller='dataset', action='new_resource', id=pkg.name) %}
<p class="empty">This dataset has no data, <a href="{{ url }}">why not add some?</a></p>
{% endtrans %}
{% else %}

View File

@ -52,7 +52,7 @@ CHANGED BY FRANCESCO.MANGIACRAPA
<div class="divider"/>
{{ h.acquire_button(package) }}
{% else %}
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name)) }}
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='dataset', action='read', id=package.name)) }}
{% endif %}
<!-- End of customizations Acquire Button -->
@ -100,7 +100,7 @@ CHANGED BY FRANCESCO.MANGIACRAPA
<div class="divider"/>
{{ h.acquire_button(package) }}
{% else %}
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name)) }}
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='dataset', action='read', id=package.name)) }}
{% endif %}
<!-- End of customizations Acquire Button -->
@ -122,7 +122,7 @@ CHANGED BY FRANCESCO.MANGIACRAPA
<ul class="dataset-resources unstyled">
{% 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" data-format="{{ resource.lower() }}">{{ resource }}</a>
<a href="{{ h.url_for(controller='dataset', action='read', id=package.name) }}" class="label" data-format="{{ resource.lower() }}">{{ resource }}</a>
</li>
{% endfor %}
</ul>

View File

@ -11,7 +11,7 @@ Removed truncate function by Francesco Mangiacrapa
<ul class="{{ _class }}">
{% for tag in tags %}
<li>
<a class="{% block tag_list_item_class %}tag{% endblock %}" href="{% url_for controller='package', action='search', tags=tag.name %}">{{ tag.display_name }}</a>
<a class="{% block tag_list_item_class %}tag{% endblock %}" href="{% url_for controller='dataset', action='search', tags=tag.name %}">{{ tag.display_name }}</a>
</li>
{% endfor %}
</ul>

View File

@ -31,7 +31,7 @@ Example:
<!--<h3 class="media-heading">{{ type.display_name }}</h3>-->
{% endblock %}
{% block link %}
<h3> <a class="media-heading" href="{% url_for controller='package', action='search', systemtype=type.name %}" title="{{ _('View {name}').format(name=type.display_name) }} {{ _('datasets')}}">{{ h.truncate(type.display_name, 26) }}</a>
<h3> <a class="media-heading" href="{% url_for controller='dataset', action='search', systemtype=type.name %}" title="{{ _('View {name}').format(name=type.display_name) }} {{ _('datasets')}}">{{ h.truncate(type.display_name, 26) }}</a>
</a>({{type.count}})</h3>
{% endblock %}
{% endblock %}

View File

@ -37,7 +37,7 @@
{# NOT SHOW 'Edit settings' #}
{% else %}
{% if h.check_access('package_create') %}
{% link_for _('Add Dataset'), controller='package', action='new', class_="btn btn-primary", icon="plus-sign-alt" %}
{% link_for _('Add Dataset'), controller='dataset', action='new', class_="btn btn-primary", icon="plus-sign-alt" %}
{% endif %}
{% endif %}
{% endblock %}
@ -51,7 +51,7 @@
<p class="empty">
{{ _('You haven\'t created any datasets.') }}
{% if h.check_access('package_create') %}
{#{% link_for _('Create one now?'), controller='package', action='new' %}#}
{#{% link_for _('Create one now?'), controller='dataset', action='new' %}#}
{% endif %}
</p>
{% endif %}