From 9d149e4e5d8df394b5e829c507c98046c7654a1f Mon Sep 17 00:00:00 2001 From: John Martin Date: Wed, 6 Mar 2013 11:23:36 +0000 Subject: [PATCH] [#12] Makes a harvest source admin page within org look a little nicer --- .../templates_new/snippets/source_item.html | 3 +- .../templates_new/snippets/source_list.html | 2 +- .../templates_new/source/org_source_list.html | 33 ++++++++++++++++++- .../harvest/templates_new/source/search.html | 2 +- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ckanext/harvest/templates_new/snippets/source_item.html b/ckanext/harvest/templates_new/snippets/source_item.html index 5d47a95..64b9337 100644 --- a/ckanext/harvest/templates_new/snippets/source_item.html +++ b/ckanext/harvest/templates_new/snippets/source_item.html @@ -7,6 +7,7 @@ hide_resources - If true hides the resources (default: false). banner - If true displays a popular banner (default: false). truncate - The length to trucate the description to (default: 180) truncate_title - The length to truncate the title to (default: 80). +show_organization - Boolean on whether to show the related organization Example: @@ -37,7 +38,7 @@ Example:

{{ _('Datasets') }}: {{ source.status.total_datasets }} - {% if source.organization %} + {% if show_organization and source.organization %} — {{ _('Organization') }}: {{ h.link_to(source.organization.title or source.organization.name, h.url_for('organization_read', id=source.organization.name)) }} {% endif %}

diff --git a/ckanext/harvest/templates_new/snippets/source_list.html b/ckanext/harvest/templates_new/snippets/source_list.html index ce04625..6467a0d 100644 --- a/ckanext/harvest/templates_new/snippets/source_list.html +++ b/ckanext/harvest/templates_new/snippets/source_list.html @@ -17,7 +17,7 @@ Example: {% if sources %} {% endif %} diff --git a/ckanext/harvest/templates_new/source/org_source_list.html b/ckanext/harvest/templates_new/source/org_source_list.html index e625439..14b55d6 100644 --- a/ckanext/harvest/templates_new/source/org_source_list.html +++ b/ckanext/harvest/templates_new/source/org_source_list.html @@ -1,2 +1,33 @@ +{% extends 'organization/edit_base.html' %} + +{% block subtitle %}{{ _('Harvest Sources') }} - {{ super() }}{% endblock %} + +{% block primary_content_inner %} +
+

{{ _('Harvest Sources') }}

+
+

+ {%- if c.page.item_count -%} + {{ c.page.item_count }} harvest sources{{ _(" found for \"{query}\"").format(query=c.q) if c.q }} + {%- elif request.params -%} + {{ _('Sorry no harvest sources found for "{query}"').format(query=c.q) }} + {%- else -%} + {{ _('Harvest Sources') }} + {%- endif -%} +

+ {% snippet 'snippets/source_list.html', sources=c.page.items %} +
+ +
+ {{ c.page.pager() }} +{% endblock %} -{% extends 'organization/read.html' %} diff --git a/ckanext/harvest/templates_new/source/search.html b/ckanext/harvest/templates_new/source/search.html index 0a8093f..657179d 100644 --- a/ckanext/harvest/templates_new/source/search.html +++ b/ckanext/harvest/templates_new/source/search.html @@ -64,7 +64,7 @@ {% endtrans %} {% endif %} - {{ h.snippet('snippets/source_list.html', sources=c.page.items) }} + {{ h.snippet('snippets/source_list.html', sources=c.page.items, show_organization=true) }}