mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-06 23:05:10 +01:00
Easy adding of tags by clicking/tapping tag tags
This commit is contained in:
@@ -252,14 +252,14 @@ 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')
|
||||||
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')
|
@app.route('/<userkey>/add')
|
||||||
def addbookmark(userkey):
|
def addbookmark(userkey):
|
||||||
""" Bookmark add form """
|
""" Bookmark add form """
|
||||||
bookmark = Bookmark(title='', url='', tags='')
|
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):
|
def updatebookmark(userkey, request, urlhash = None):
|
||||||
|
|||||||
@@ -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://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="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"/>
|
<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>
|
</head>
|
||||||
<body class="grey lighten-4">
|
<body class="grey lighten-4">
|
||||||
<nav class="green darken-3" role="navigation">
|
<nav class="green darken-3" role="navigation">
|
||||||
@@ -54,7 +55,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- 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="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>
|
<script src="{{ url_for('static', filename='js/init.js') }}"></script>
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,29 @@
|
|||||||
<input placeholder="tags, divided by comma's" type="text" name="tags" id="tags" value="{{ bookmark.tags }}" class="validate" />
|
<input placeholder="tags, divided by comma's" type="text" name="tags" id="tags" value="{{ bookmark.tags }}" class="validate" />
|
||||||
<label for="tags">Tags</label>
|
<label for="tags">Tags</label>
|
||||||
</div>
|
</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">
|
<div class="input-field col s12">
|
||||||
{#<i class="material-icons prefix">star</i>#}
|
{#<i class="material-icons prefix">star</i>#}
|
||||||
|
|||||||
Reference in New Issue
Block a user