implement bookmark deletion
This commit is contained in:
@ -60,7 +60,7 @@ class BookmarksController(AuthorizationMixin, WebpageController):
|
||||
<td class="frequency">{frequency}</td>
|
||||
<td data-value="{modulation}">{modulation_name}</td>
|
||||
<td>
|
||||
<div class="btn btn-sm btn-danger bookmark-delete">delete</div>
|
||||
<button class="btn btn-sm btn-danger bookmark-delete">delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
""".format(
|
||||
@ -111,5 +111,16 @@ class BookmarksController(AuthorizationMixin, WebpageController):
|
||||
except json.JSONDecodeError:
|
||||
self.send_response("{}", content_type="application/json", code=400)
|
||||
|
||||
def delete(self):
|
||||
bookmark_id = int(self.request.matches.group(1))
|
||||
bookmark = self._findBookmark(bookmark_id)
|
||||
if bookmark is None:
|
||||
self.send_response("{}", content_type="application/json", code=404)
|
||||
return
|
||||
bookmarks = Bookmarks.getSharedInstance()
|
||||
bookmarks.removeBookmark(bookmark)
|
||||
bookmarks.store()
|
||||
self.send_response("{}", content_type="application/json", code=200)
|
||||
|
||||
def indexAction(self):
|
||||
self.serve_template("settings/bookmarks.html", **self.template_variables())
|
||||
|
Reference in New Issue
Block a user