From 2a53e4a2e4797c0b6e5597c2a1628478269aabfc Mon Sep 17 00:00:00 2001 From: John Martin Date: Fri, 8 Mar 2013 12:38:41 +0000 Subject: [PATCH 1/3] [#14] Couple of minor template tweaks --- .../harvest/templates_new/snippets/source_item.html | 2 +- .../templates_new/source/org_source_list.html | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ckanext/harvest/templates_new/snippets/source_item.html b/ckanext/harvest/templates_new/snippets/source_item.html index 4ae3c4c..200d90f 100644 --- a/ckanext/harvest/templates_new/snippets/source_item.html +++ b/ckanext/harvest/templates_new/snippets/source_item.html @@ -18,7 +18,7 @@ Example: {% set truncate_title = truncate_title or 80 %} {% set title = source.title or source.name %} {% set source_type = h.get_pkg_dict_extra(source, 'source_type') %} -{% set url = h.url_for('harvest_edit', id=source.name) if within_organization else h.url_for('harvest_read', id=source.name) %} +{% set url = h.url_for('harvest_admin', id=source.name) if within_organization else h.url_for('harvest_read', id=source.name) %}
  • diff --git a/ckanext/harvest/templates_new/source/org_source_list.html b/ckanext/harvest/templates_new/source/org_source_list.html index f0632b8..588bb44 100644 --- a/ckanext/harvest/templates_new/source/org_source_list.html +++ b/ckanext/harvest/templates_new/source/org_source_list.html @@ -6,6 +6,12 @@

    {{ _('Harvest Sources') }}

    +

    {%- if c.page.item_count -%} {{ c.page.item_count }} harvest sources{{ _(" found for \"{query}\"").format(query=c.q) if c.q }} @@ -15,7 +21,11 @@ {{ _('Harvest Sources') }} {%- endif -%}

    - {% snippet 'snippets/source_list.html', sources=c.page.items, within_organization=true %} + {% if c.page.item_count %} + {% snippet 'snippets/source_list.html', sources=c.page.items, within_organization=true %} + {% else %} +

    {{ _('Sorry no harvest sources found') }}

    + {% endif %}
    {{ c.page.pager() }} {% endblock %} - From f25ef19985b29e66d741d306bc704301d2c0a637 Mon Sep 17 00:00:00 2001 From: John Martin Date: Fri, 8 Mar 2013 12:48:11 +0000 Subject: [PATCH 2/3] [#14] Fix for org breadcrumbs on sources --- ckanext/harvest/templates_new/source/base.html | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ckanext/harvest/templates_new/source/base.html b/ckanext/harvest/templates_new/source/base.html index 8be4e80..76a07d7 100644 --- a/ckanext/harvest/templates_new/source/base.html +++ b/ckanext/harvest/templates_new/source/base.html @@ -11,14 +11,11 @@ {% block breadcrumb_content_root_selected %} class="active"{% endblock %} -{# - TODO: once #354 is merged in CKAN core we can re-adjust the truncation - lengths here (as the breadcrumbs are a little different in #354) -#} {% block breadcrumb_content %} - {% if source.organization %} + {% if source.__extras.organization %} + {% set org = source.__extras.organization %}
  • {{ h.nav_named_link(_('Organizations'), 'organizations_index') }}
  • -
  • {{ h.nav_named_link(source.organization.title or source.organization.name|truncate(10), 'organization_read', id=source.organization.name) }}
  • +
  • {{ h.nav_named_link(org.title or org.name|truncate(10), 'organization_read', id=org.name) }}
  • {{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}
  • {{ h.nav_named_link(c.harvest_source.title|truncate(10), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name) }} {% else %} From ecceff48ed580f1c3b6ea666234b01674a1e9ee6 Mon Sep 17 00:00:00 2001 From: amercader Date: Fri, 8 Mar 2013 14:48:49 +0000 Subject: [PATCH 3/3] [#14] Use source.organization again after fix in 949bb6f --- ckanext/harvest/templates_new/source/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ckanext/harvest/templates_new/source/base.html b/ckanext/harvest/templates_new/source/base.html index 76a07d7..0d4712c 100644 --- a/ckanext/harvest/templates_new/source/base.html +++ b/ckanext/harvest/templates_new/source/base.html @@ -12,8 +12,8 @@ {% block breadcrumb_content_root_selected %} class="active"{% endblock %} {% block breadcrumb_content %} - {% if source.__extras.organization %} - {% set org = source.__extras.organization %} + {% if source.organization %} + {% set org = source.organization %}
  • {{ h.nav_named_link(_('Organizations'), 'organizations_index') }}
  • {{ h.nav_named_link(org.title or org.name|truncate(10), 'organization_read', id=org.name) }}
  • {{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}