From 246898049e9b1e6f48c30e1eb9594b7d10bfe516 Mon Sep 17 00:00:00 2001 From: John Martin Date: Wed, 6 Mar 2013 11:36:24 +0000 Subject: [PATCH] [#12] When harvest source listing is within org links goto edit pages --- ckanext/harvest/templates_new/snippets/source_item.html | 5 +++-- ckanext/harvest/templates_new/snippets/source_list.html | 2 +- ckanext/harvest/templates_new/source/org_source_list.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ckanext/harvest/templates_new/snippets/source_item.html b/ckanext/harvest/templates_new/snippets/source_item.html index 64b9337..4d15e4e 100644 --- a/ckanext/harvest/templates_new/snippets/source_item.html +++ b/ckanext/harvest/templates_new/snippets/source_item.html @@ -18,11 +18,12 @@ 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_source_edit', id=source.name) if within_organization else h.url_for('harvest_source_read', id=source.name) %}
  • - {{ h.link_to(h.truncate(title, truncate_title), h.url_for('harvest_source_read', id=source.name)) }} + {{ h.link_to(h.truncate(title, truncate_title), url) }} {% if source.get(state, '').startswith('draft') %} {{ _('Draft') }} {% elif source.get(state, '').startswith('deleted') %} @@ -38,7 +39,7 @@ Example:

    {{ _('Datasets') }}: {{ source.status.total_datasets }} - {% if show_organization and source.organization %} + {% if not within_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 6467a0d..1cc9154 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 %}
      {% for source in sources %} - {% snippet 'snippets/source_item.html', source=source, item_class=item_class, hide_resources=hide_resources, banner=banner, truncate=truncate, truncate_title=truncate_title, show_organization=show_organization %} + {% snippet 'snippets/source_item.html', source=source, item_class=item_class, hide_resources=hide_resources, banner=banner, truncate=truncate, truncate_title=truncate_title, within_organization=within_organization %} {% endfor %}
    {% endif %} diff --git a/ckanext/harvest/templates_new/source/org_source_list.html b/ckanext/harvest/templates_new/source/org_source_list.html index 14b55d6..8ef67a2 100644 --- a/ckanext/harvest/templates_new/source/org_source_list.html +++ b/ckanext/harvest/templates_new/source/org_source_list.html @@ -15,7 +15,7 @@ {{ _('Harvest Sources') }} {%- endif -%}

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