Skip to content
Snippets Groups Projects
Commit 41788569 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Merge branch '64-upgrade-for-ckan-2-10' into add-author-maintainer-information

parents 7457ed8d a8cc2a85
No related branches found
No related tags found
1 merge request!51Display contact information on dataset page and use text-ellipsis for long description texts
...@@ -174,5 +174,7 @@ def get_latest_resources_for_format(collection_name, resource_format): ...@@ -174,5 +174,7 @@ def get_latest_resources_for_format(collection_name, resource_format):
if not resources: if not resources:
return None return None
resources_with_asked_type = [r for r in resources if r.get('format').upper() == resource_format.upper()] resources_with_asked_type = [r for r in resources if r.get('format').upper() == resource_format.upper()]
if not resources_with_asked_type:
return None
resources_sorted = sorted(resources_with_asked_type, key=itemgetter('id','created'), reverse=True) resources_sorted = sorted(resources_with_asked_type, key=itemgetter('id','created'), reverse=True)
return resources_sorted[-1] return resources_sorted[-1]
...@@ -57,7 +57,7 @@ class CollectionsPlugin(plugins.SingletonPlugin, DefaultDatasetForm): ...@@ -57,7 +57,7 @@ class CollectionsPlugin(plugins.SingletonPlugin, DefaultDatasetForm):
url_type = latest_resources.get('url_type') url_type = latest_resources.get('url_type')
if url_type is None: if url_type is None:
resource_url = latest_resources.get('url') resource_url = latest_resources.get('url')
toolkit.redirect_to(resource_url) return toolkit.redirect_to(resource_url)
if url_type == 'upload': if url_type == 'upload':
download_package_id = latest_resources.get('package_id') download_package_id = latest_resources.get('package_id')
download_resource_id = latest_resources.get('id') download_resource_id = latest_resources.get('id')
......
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
{{ form.input_address('gnd','GND URI', value=extras.gnd, index=6, placeholder='https://d-nb.info/gnd/1136109587', type='text', attrs={}) }} {{ form.input_address('gnd','GND URI', value=extras.gnd, index=6, placeholder='https://d-nb.info/gnd/1136109587', type='text', attrs={}) }}
<!-- {% for extra in data.extras %}
{% set custom_extras = ['person','street','location','telephone','mail','web','gnd'] %} {% set custom_extras = ['person','street','location','telephone','mail','web','gnd'] %}
{% for extra in data.extras %}
{% if extra.key not in custom_extras %} {% if extra.key not in custom_extras %}
{% set prefix = 'extras__%d__' % (loop.index0 + (custom_extras|count)) %} {% set prefix = 'extras__%d__' % (loop.index0 + (custom_extras|count)) %}
{{ form.custom( {{ form.custom(
...@@ -63,11 +63,12 @@ ...@@ -63,11 +63,12 @@
{# Add a max of 3 empty columns #} {# Add a max of 3 empty columns #}
{% set total_extras = data.extras|count %} {% set total_extras = data.extras|count %}
{% if total_extras <= (custom_extras|count) %}{% set total_extras = (custom_extras|count) %}{% endif %}
{% set empty_extras = (limit or 3) - total_extras %} {% set empty_extras = (limit or 3) - total_extras %}
{% if empty_extras <= 0 %}{% set empty_extras = 1 %}{% endif %} {% if empty_extras <= 0 %}{% set empty_extras = 1 %}{% endif %}
{% for extra in range(total_extras, total_extras + empty_extras) %} {% for extra in range(total_extras, total_extras + empty_extras) %}
{% set index = loop.index0 + (data.extras|count) + (custom_extras|count) %} {% set index = loop.index0 + total_extras %}
{% set prefix = 'extras__%d__' % index %} {% set prefix = 'extras__%d__' % index %}
{{ form.custom( {{ form.custom(
names=(prefix ~ 'key', prefix ~ 'value', prefix ~ 'deleted'), names=(prefix ~ 'key', prefix ~ 'value', prefix ~ 'deleted'),
...@@ -76,7 +77,7 @@ ...@@ -76,7 +77,7 @@
values=(extra.key, extra.value, extra.deleted), values=(extra.key, extra.value, extra.deleted),
error=errors[prefix ~ 'key'] or errors[prefix ~ 'value'] error=errors[prefix ~ 'key'] or errors[prefix ~ 'value']
) }} ) }}
{% endfor %} --> {% endfor %}
</div> </div>
{% endblock %} {% endblock %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment