1
0
mirror of https://github.com/aquatix/digimarks.git synced 2025-12-06 22:05:09 +01:00

Easy adding of tags by clicking/tapping tag tags

This commit is contained in:
2016-07-31 14:33:31 +02:00
parent 5f0e3bb730
commit 6be78117c2
3 changed files with 26 additions and 3 deletions

View File

@@ -252,14 +252,14 @@ def editbookmark(userkey, urlhash):
# bookmark = getbyurlhash()
bookmark = Bookmark.get(Bookmark.url_hash == urlhash, Bookmark.userkey == userkey)
message = request.args.get('message')
return render_template('edit.html', action='Edit bookmark', userkey=userkey, bookmark=bookmark, message=message, formaction='edit')
return render_template('edit.html', action='Edit bookmark', userkey=userkey, bookmark=bookmark, message=message, formaction='edit', tags=all_tags[userkey])
@app.route('/<userkey>/add')
def addbookmark(userkey):
""" Bookmark add form """
bookmark = Bookmark(title='', url='', tags='')
return render_template('edit.html', action='Add bookmark', userkey=userkey, bookmark=bookmark)
return render_template('edit.html', action='Add bookmark', userkey=userkey, bookmark=bookmark, tags=all_tags[userkey])
def updatebookmark(userkey, request, urlhash = None):

View File

@@ -19,6 +19,7 @@
<link href='https://fonts.googleapis.com/css?family=Roboto+Mono&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="{{ url_for('static', filename='css/digimarks.css') }}" type="text/css" rel="stylesheet" media="screen,projection"/>
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
</head>
<body class="grey lighten-4">
<nav class="green darken-3" role="navigation">
@@ -54,7 +55,6 @@
</div>
<!-- Scripts -->
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
<script src="{{ url_for('static', filename='js/init.js') }}"></script>

View File

@@ -56,6 +56,29 @@
<input placeholder="tags, divided by comma's" type="text" name="tags" id="tags" value="{{ bookmark.tags }}" class="validate" />
<label for="tags">Tags</label>
</div>
</div>
{% if tags %}
<div class="row">
<div class="col s12">
{% for tag in tags %}
<div class="chip" id="tag_{{ tag }}">
{{ tag }}
</div>
{% endfor %}
</div>
{% for tag in tags %}
<script type="text/javascript">
$(function () {
$('#tag_{{ tag }}').on('click', function () {
var text = $('#tags');
text.val(text.val() + ', {{ tag }}');
});
});
</script>
{% endfor %}
</div>
{% endif %}
<div class="row">
<div class="input-field col s12">
{#<i class="material-icons prefix">star</i>#}