Skip to content

Commit

Permalink
Merge branch '64-geodata-theme' into dev.publicamundi.eu
Browse files Browse the repository at this point in the history
  • Loading branch information
drmalex07 committed Jun 6, 2015
2 parents 7a3f37f + 311b8c9 commit c84a49b
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 57 deletions.
16 changes: 8 additions & 8 deletions ckanext/publicamundi/templates/user/snippets/package_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
{# Display a list of ingestion-aware resources #}
{% block package_item_resources %}
<ul class="resources unstyled">
{% for resource in package.resources %}
{% if resource.vectorstorer_resource or resource.rasterstorer_resource %}
{% with task_result = h.resource_ingestion_result(resource.id) %}
{% snippet 'user/snippets/resource_item_ingested.html', pkg=package, res=resource, task=task_result, parent=parent %}
{% endwith %} {# task_result #}
{% else %}
{% snippet 'user/snippets/resource_item.html', pkg=package, res=resource, parent=parent %}
{% endif %}
{% for resource in package.resources %}
{% if resource.vectorstorer_resource or resource.rasterstorer_resource %}
{% set task_result = h.resource_ingestion_result(resource.id) %}
{% else %}
{% set task_result = {} %}
{% endif %}
{% snippet 'user/snippets/resource_item.html', pkg=package, res=resource, task=task_result, parent=parent %}
{% endfor %} {# resource #}
</ul>
{% endblock %}
23 changes: 22 additions & 1 deletion ckanext/publicamundi/templates/user/snippets/resource_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,29 @@
>{{ h.resource_display_name(res)|truncate(50) }}<span class="format-label" property="dc:format" data-format="{{ res.format.lower() or 'data' }}">{{ res.format }}</span></a>

<div class="resource-ingest-actions pull-right">
{% if not task %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=none, status_text=_('No Action') %}
{% else %}
{% if not task.found %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=none, status_text=_('No Action') %}

{% elif task.status == "identified" %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=task.status, status_text=_('Identified') %}
{% snippet 'user/snippets/identified_resource.html', pkg=pkg, res=res, task=task, parent= parent %}
{% elif task.status == "rejected" %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=task.status, status_text=_('Rejected') %}
{% snippet 'user/snippets/rejected_resource.html', pkg=pkg, res=res, task=task, parent= parent %}
{% elif task.status == "published" %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=task.status, status_text=_('Published') %}
{% elif task.status == "publishing" %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=task.status, status_text=_('Publishing') %}
{% elif task.status == "publish-failed" %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=task.status, status_text=_('Publish Failed') %}
{% elif task.status == "identifying" %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=task.status, status_text=_('Not Ready') %}
{% elif task.status == "identify-failed" %}
{% snippet 'user/snippets/resource_ingest_status_label.html', status=task.status, status_text=_('Identify Failed') %}
{% endif %}
{% endif %}
</div>

{% with description = res.description|truncate(90) %}
Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions ckanext/publicamundi/themes/geodata/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ def friendly_date(date_str):
def feedback_form():
return _feedback_form

def get_maps_url(id=None):
def get_maps_url(package_id=None, resource_id=None):
locale = helpers.lang()
if _maps_url:
if id:
return('{0}/{1}?lang={2}'.format(_maps_url, id, locale))
if package_id and resource_id:
return('{0}?package={1}&resource={2}&locale={3}'.format(_maps_url, package_id, resource_id, locale))
else:
return('{0}?lang={1}'.format(_maps_url, locale))
return('{0}?locale={1}'.format(_maps_url, locale))
else:
return '/'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% block resource_item_service %}
{% if (res.vectorstorer_resource or res.rasterstorer_resource) and res.format == 'wms' %}
<li>
<a class="btn" href={{ h.get_maps_url(id=res.id)}} >
<a class="btn" href={{ h.get_maps_url(package_id=pkg.id, resource_id=res.id)}} >
<i class="icon-medium icon-globe"></i>{{ _(' Map')}}
</a>
</li>
Expand All @@ -25,7 +25,7 @@
{% for raster_res in raster_resources %}
{% if raster_res.format == 'wms' %}
<li>
<a class="btn" href={{ h.get_maps_url(id=raster_res.id)}} >
<a class="btn" href={{ h.get_maps_url(package_id=pkg.id, resource_id=raster_res.id) }} >
<i class="icon-medium icon-globe"></i>{{ _(' Maps')}}
</a>
</li>
Expand All @@ -34,7 +34,8 @@
{% for vector_res in vector_resources %}
{% if vector_res.format == 'wms' %}
<li>
<a class="btn" href={{ h.get_maps_url(id=vector_res.id)}} >
<a class="btn" href={{ h.get_maps_url(package_id=pkg.id, resource_id=vector_res.id) }} >

<i class="icon-medium icon-globe"></i>{{ _(' Map')}}
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{% for raster_res in raster_resources %}
{% if raster_res.format == 'wms' %}
<div class="action-button"><a class="btn" href={{ h.get_maps_url(id=raster_res.id)}} >
<div class="action-button"><a class="btn" href={{ h.get_maps_url(package_id=pkg.id, resource_id=raster_res.id)}} >
<i class="icon-medium icon-globe"></i>{{ _(' Map')}}
</a>
</div>
Expand All @@ -17,7 +17,7 @@

{% for vector_res in vector_resources %}
{% if vector_res.format == 'wms' %}
<div class="action-button"><a class="btn" href={{ h.get_maps_url(id=vector_res.id)}} >
<div class="action-button"><a class="btn" href={{ h.get_maps_url(package_id=pkg.id, resource_id=vector_res.id)}} >
<i class="icon-medium icon-globe"></i>{{ _(' Map')}}
</a>
</div>
Expand Down

0 comments on commit c84a49b

Please sign in to comment.