recursive tags_w_lists
This commit is contained in:
parent
bd87247240
commit
ef62052984
@ -131,7 +131,7 @@ def tags_w_lists():
|
|||||||
t = {'tag': k, 'desc': v['desc']}
|
t = {'tag': k, 'desc': v['desc']}
|
||||||
l = []
|
l = []
|
||||||
for m in v['lists']:
|
for m in v['lists']:
|
||||||
l += recursive_info(m)
|
l += recursive_info(m, keep_hierachy=True)
|
||||||
t['lists'] = l
|
t['lists'] = l
|
||||||
tags.append(t)
|
tags.append(t)
|
||||||
return tags
|
return tags
|
||||||
@ -189,11 +189,23 @@ def recursive_urls(msg):
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
# <li><a href="' + h.url+ '" target="_blank">' + h.subject + '</a> -- <i>' + h.author_name + '</i>
|
# <li><a href="' + h.url+ '" target="_blank">' + h.subject + '</a> -- <i>' + h.author_name + '</i>
|
||||||
def recursive_info(msg):
|
def recursive_info(msg, keep_hierachy=False):
|
||||||
|
|
||||||
r = [{'url': msg['url'], 'subject': msg['subject'], 'author_name': msg['author_name']}]
|
r = [{'url': msg['url'], 'subject': msg['subject'], 'author_name': msg['author_name']}]
|
||||||
|
|
||||||
|
if keep_hierachy:
|
||||||
|
rr = []
|
||||||
|
|
||||||
if 'follow-up' in list(msg.keys()):
|
if 'follow-up' in list(msg.keys()):
|
||||||
for m in msg['follow-up']:
|
for m in msg['follow-up']:
|
||||||
|
if keep_hierachy:
|
||||||
|
rr += recursive_info(m)
|
||||||
|
else:
|
||||||
r += recursive_info(m)
|
r += recursive_info(m)
|
||||||
|
|
||||||
|
if keep_hierachy:
|
||||||
|
r[0]['follow'] = rr #note: change of field name
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def commit_selection(li, url, tag):
|
def commit_selection(li, url, tag):
|
||||||
|
|||||||
@ -1,54 +1,11 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>URLCOLLECT</title>
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static',filename='jquery.tag-editor.css') }}">
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static',filename='lestyle.css') }}">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action="/collect" method="get" id="collect">
|
<h1>-INDEX-</h1>
|
||||||
<h2>*************************************GET::</h2>
|
<h2><a href="/search">SEARCH</a></h2>
|
||||||
|
<h2><a href="/tags">TAGS</a></h2>
|
||||||
<label for="url">url</label>
|
<h2><a href="/tags_w_lists">TAGS_W_LISTS</a></h2>
|
||||||
<input type="text" name="url" id="url">
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
{% for l in lists %}
|
|
||||||
{{l}} <input type="radio" name="list" value="{{l}}">
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
<label for="tags">tags</label>
|
|
||||||
<input type="text" name="tags" id="tags">
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
<label for="tags">existing tags: </label>
|
|
||||||
<pre id="list_tags">
|
|
||||||
{% for t in tags %}
|
|
||||||
{{t}}
|
|
||||||
{% endfor %}
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
<button type="submit" id="submit">collect!</button>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
---
|
|
||||||
<br>
|
|
||||||
<pre id="report"></pre>
|
|
||||||
---
|
|
||||||
<br>
|
|
||||||
<pre id="serv"></pre>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
<div id="collected"></div>
|
|
||||||
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
|
|
||||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
|
||||||
<script src="{{ url_for('static',filename='jquery.caret.min.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static',filename='jquery.tag-editor.min.js') }}"></script>
|
|
||||||
<script src="{{ url_for('static',filename='collect.js') }}"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -22,8 +22,13 @@
|
|||||||
</form>
|
</form>
|
||||||
<lists>
|
<lists>
|
||||||
<ul>
|
<ul>
|
||||||
{% for h in v.lists %}
|
{% for h in v.lists recursive %}
|
||||||
<li data-tag="{{v.tag}}" data-url="{{h.url}}"><a href="{{h.url}}" target="_blank">{{h.subject}}</a> -- <i>{{h.author_name}}</i> <button class="del">del</button></li>
|
<li data-tag="{{v.tag}}" data-url="{{h.url}}"><a href="{{h.url}}" target="_blank">{{h.subject}}</a> -- <i>{{h.author_name}}</i> <button class="del">del</button></li>
|
||||||
|
{% if h.follow %}
|
||||||
|
<ul>
|
||||||
|
{{ loop(h.follow) }}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</lists>
|
</lists>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user