mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-07 01:25:11 +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:
|
#else:
|
||||||
# abort(404)
|
# abort(404)
|
||||||
tags = get_tags_for_user(userkey)
|
tags = get_tags_for_user(userkey)
|
||||||
|
message = request.args.get('message')
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
filter_on = request.form['filter']
|
filter_on = request.form['filter']
|
||||||
bookmarks = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.title.contains(filter_on))
|
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:
|
else:
|
||||||
bookmarks = Bookmark.select().where(Bookmark.userkey == userkey)
|
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 = getbyurlhash()
|
||||||
bookmark = Bookmark.get(Bookmark.url_hash == urlhash, Bookmark.userkey == userkey)
|
bookmark = Bookmark.get(Bookmark.url_hash == urlhash, Bookmark.userkey == userkey)
|
||||||
message = request.args.get('message')
|
message = request.args.get('message')
|
||||||
print bookmark.url
|
|
||||||
return render_template('edit.html', action='Edit bookmark', userkey=userkey, bookmark=bookmark, message=message)
|
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'])
|
@app.route('/<userkey>/<urlhash>/delete', methods=['GET', 'POST'])
|
||||||
def deletingbookmark(userkey, urlhash):
|
def deletingbookmark(userkey, urlhash):
|
||||||
""" Delete the bookmark from form submit by <urlhash>/delete """
|
""" Delete the bookmark from form submit by <urlhash>/delete """
|
||||||
# TODO implement
|
Bookmark.delete().where(Bookmark.userkey==userkey, Bookmark.url_hash==urlhash)
|
||||||
return redirect(url_for('bookmarks', userkey=userkey))
|
message = 'Bookmark deleted'
|
||||||
|
return redirect(url_for('bookmarks', userkey=userkey, message=message))
|
||||||
|
|
||||||
|
|
||||||
@app.route('/<userkey>/tags')
|
@app.route('/<userkey>/tags')
|
||||||
|
|||||||
@@ -3,6 +3,18 @@
|
|||||||
{% block pageheader %}Bookmarks{% endblock %}
|
{% block pageheader %}Bookmarks{% endblock %}
|
||||||
{% block pagecontent %}
|
{% 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">
|
<div class="row">
|
||||||
<form action="{{ url_for('bookmarks', userkey=userkey) }}" method="POST">
|
<form action="{{ url_for('bookmarks', userkey=userkey) }}" method="POST">
|
||||||
<div class="input-field col l10 m10 s8">
|
<div class="input-field col l10 m10 s8">
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
{% if bookmark.url_hash %}
|
{% if bookmark.url_hash %}
|
||||||
<div class="input-field col l2 m3 s4">
|
<div class="input-field col l2 m3 s4">
|
||||||
<form action="{{ url_for('deletingbookmark', userkey=userkey, urlhash=bookmark.url_hash) }}" method="POST">
|
<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>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user