Add option to delete harvesting sources

This commit is contained in:
Adrià Mercader 2011-03-11 12:41:13 +00:00
parent 58164e915d
commit 696a8dc058
3 changed files with 14 additions and 1 deletions

View File

@ -55,6 +55,10 @@ class Harvest(SingletonPlugin):
controller='ckanext.harvest.controllers.view:ViewController',
action='show')
map.connect('harvest_show', '/harvest/:id/delete',
controller='ckanext.harvest.controllers.view:ViewController',
action='delete')
map.connect('harvest_create', '/harvest/:id/refresh',
controller='ckanext.harvest.controllers.view:ViewController',
action='create_harvesting_job')

View File

@ -83,7 +83,14 @@ class ViewController(BaseController):
c.source = json.loads(doc)
return render('ckanext/harvest/show.html')
def delete(self,id):
form_url = self.form_api_url + '/harvestsource/delete/%s' % id
r = self._do_request(form_url)
h.flash_success('Harvesting source deleted successfully')
redirect(h.url_for(controller='harvest', action='index', id=None))
def create_harvesting_job(self,id):
form_url = self.api_url + '/harvestingjob'
data = {

View File

@ -15,6 +15,7 @@
<a id="new-harvest-source" href="harvest/create">Add a harvesting source</a>
<table id="harvest-sources">
<tr>
<th></th>
<th></th>
<th></th>
<th>URL</th>
@ -26,6 +27,7 @@
<tr py:for="source in c.sources">
<td>${h.link_to('view', 'harvest/' + source.id)}</td>
<td>${h.link_to('delete', 'harvest/' + source.id + '/delete')}</td>
<td>${h.link_to('refresh', 'harvest/' + source.id + '/refresh')}</td>
<td>${source.url}</td>
<td>${source.status.last_harvest_status}</td>