mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-06 23:05:10 +01:00
Implemented bookmark deletion, show message on overview
This commit is contained in:
11
digimarks.py
11
digimarks.py
@@ -189,13 +189,14 @@ def bookmarks(userkey):
|
||||
#else:
|
||||
# abort(404)
|
||||
tags = get_tags_for_user(userkey)
|
||||
message = request.args.get('message')
|
||||
if request.method == 'POST':
|
||||
filter_on = request.form['filter']
|
||||
bookmarks = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.title.contains(filter_on))
|
||||
return render_template('bookmarks.html', bookmarks=bookmarks, userkey=userkey, tags=tags, filter=filter_on)
|
||||
return render_template('bookmarks.html', bookmarks=bookmarks, userkey=userkey, tags=tags, filter=filter_on, message=message)
|
||||
else:
|
||||
bookmarks = Bookmark.select().where(Bookmark.userkey == userkey)
|
||||
return render_template('bookmarks.html', bookmarks=bookmarks, userkey=userkey, tags=tags)
|
||||
return render_template('bookmarks.html', bookmarks=bookmarks, userkey=userkey, tags=tags, message=message)
|
||||
|
||||
|
||||
|
||||
@@ -220,7 +221,6 @@ def editbookmark(userkey, urlhash):
|
||||
# bookmark = getbyurlhash()
|
||||
bookmark = Bookmark.get(Bookmark.url_hash == urlhash, Bookmark.userkey == userkey)
|
||||
message = request.args.get('message')
|
||||
print bookmark.url
|
||||
return render_template('edit.html', action='Edit bookmark', userkey=userkey, bookmark=bookmark, message=message)
|
||||
|
||||
|
||||
@@ -278,8 +278,9 @@ def addingbookmark(userkey):
|
||||
@app.route('/<userkey>/<urlhash>/delete', methods=['GET', 'POST'])
|
||||
def deletingbookmark(userkey, urlhash):
|
||||
""" Delete the bookmark from form submit by <urlhash>/delete """
|
||||
# TODO implement
|
||||
return redirect(url_for('bookmarks', userkey=userkey))
|
||||
Bookmark.delete().where(Bookmark.userkey==userkey, Bookmark.url_hash==urlhash)
|
||||
message = 'Bookmark deleted'
|
||||
return redirect(url_for('bookmarks', userkey=userkey, message=message))
|
||||
|
||||
|
||||
@app.route('/<userkey>/tags')
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
{% block pageheader %}Bookmarks{% endblock %}
|
||||
{% block pagecontent %}
|
||||
|
||||
{% if message %}
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<div class="card-panel orange lighten-2">
|
||||
<span class="white-text">
|
||||
{{ message }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<form action="{{ url_for('bookmarks', userkey=userkey) }}" method="POST">
|
||||
<div class="input-field col l10 m10 s8">
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
{% if bookmark.url_hash %}
|
||||
<div class="input-field col l2 m3 s4">
|
||||
<form action="{{ url_for('deletingbookmark', userkey=userkey, urlhash=bookmark.url_hash) }}" method="POST">
|
||||
<p class="left-align"><button class="btn btn-large waves-effect waves-light" type="button" name="delete">Delete</button></p>
|
||||
<p class="left-align"><button class="btn btn-large waves-effect waves-light" type="submit" name="delete">Delete</button></p>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user