diff --git a/ckanext/harvest/controllers/view.py b/ckanext/harvest/controllers/view.py index ea01a5f..b3567b2 100644 --- a/ckanext/harvest/controllers/view.py +++ b/ckanext/harvest/controllers/view.py @@ -31,7 +31,8 @@ class ViewController(BaseController): p.toolkit.get_action('harvest_source_delete')(context, {'id':id}) h.flash_success(_('Harvesting source successfully inactivated')) - redirect(h.url_for('harvest')) + + redirect(h.url_for('{0}_admin'.format(DATASET_TYPE_NAME), id=id)) except p.toolkit.ObjectNotFound: abort(404,_('Harvest source not found')) except p.toolkit.NotAuthorized: diff --git a/ckanext/harvest/templates_new/source/new_source_form.html b/ckanext/harvest/templates_new/source/new_source_form.html index a04dd29..f9e8e5f 100644 --- a/ckanext/harvest/templates_new/source/new_source_form.html +++ b/ckanext/harvest/templates_new/source/new_source_form.html @@ -70,11 +70,23 @@ {% endif %} {% endif %} + {% if data.get('id', None) and h.check_access('harvest_source_delete', {'id': data.id}) and data.get('state', 'none') == 'deleted' %} +
{% block delete_button %} - {% if h.check_access('harvest_source_delete', {'id': data.id}) %} + {% if data.get('id', None) and h.check_access('harvest_source_delete', {'id': data.id}) and not data.get('state', 'none') == 'deleted' %} {% set locale = h.dump_json({'content': _('Are you sure you want to delete this harvest source?')}) %} - {% block delete_button_text %}{{ _('Delete') }}{% endblock %} + {% block delete_button_text %}{{ _('Delete') }}{% endblock %} {% endif %} {% endblock %}