diff --git a/inquisitor/app.py b/inquisitor/app.py
index 12b4c5d..7ebf5fb 100644
--- a/inquisitor/app.py
+++ b/inquisitor/app.py
@@ -42,10 +42,13 @@ def root():
total = 0
items, errors = loader.load_active_items()
active_items = []
- active_tags = set()
+ active_tags = {}
for item in items:
if item['active']:
- active_tags |= set(item['tags'])
+ for tag in item['tags']:
+ if tag not in active_tags: active_tags[tag] = 0
+ active_tags[tag] += 1
+ # active_tags |= set(item['tags'])
total += 1
if not any(map(lambda f: f(item), filters)):
active_items.append(item)
@@ -63,16 +66,28 @@ def root():
if total > 0:
# Create the feed control item
- wl_minus = [make_query_link("only - {}".format(tag), [t for t in wl if t != tag], bl) for tag in wl]
- wl_plus = [make_query_link("only + {}".format(tag), wl + [tag], bl) for tag in active_tags if tag not in wl]
- bl_minus = [make_query_link("not - {}".format(tag), wl, [t for t in bl if t != tag]) for tag in bl]
- bl_plus = [make_query_link("not + {}".format(tag), wl, bl + [tag]) for tag in active_tags if tag not in bl]
- body = "
{}
".format("\n".join(wl_minus + wl_plus + bl_minus + bl_plus))
+ link_table = []
+ for tag, count in sorted(active_tags.items()):
+ links = [count]
+ links.append(make_query_link(tag, [tag], []))
+ if tag in wl:
+ new_wl = [t for t in wl if t != tag]
+ links.append(make_query_link("-only", new_wl, bl))
+ else:
+ new_bl = [t for t in bl if t != tag]
+ links.append(make_query_link("+only", wl + [tag], new_bl))
+ if tag in bl:
+ new_bl = [t for t in bl if t != tag]
+ links.append(make_query_link("-not", wl, new_bl))
+ else:
+ new_wl = [t for t in wl if t != tag]
+ links.append(make_query_link("+not", new_wl, bl + [tag]))
+ link_table.append("
{0}
{1}
{2}
{3}
".format(*links))
+ body = '
{}
'.format("\n".join(link_table))
feed_control = {
- 'title': 'Feed Control [{}]'.format(total),
+ 'title': 'Feed Control [{}/{}]'.format(len(active_items), total),
'body': body,
- 'created': None,
}
active_items.insert(0, feed_control)
diff --git a/inquisitor/resources/feed.css b/inquisitor/resources/feed.css
index 356a355..b533f0f 100644
--- a/inquisitor/resources/feed.css
+++ b/inquisitor/resources/feed.css
@@ -43,4 +43,8 @@ summary:focus {
}
pre {
white-space: pre-wrap;
+}
+table.feed-control td /*:nth-child(2), td:nth-child(3), td:nth-child(4)*/ {
+ font-family: monospace;
+ padding: 5px 10px;
}
\ No newline at end of file
diff --git a/inquisitor/templates/feed.html b/inquisitor/templates/feed.html
index 6796bd4..a2cf0c8 100644
--- a/inquisitor/templates/feed.html
+++ b/inquisitor/templates/feed.html
@@ -26,37 +26,25 @@
{% if items %}
{% for item in items %}
- {% if item.id %}
-
- {% endif %}
- {% if item.link %}
- ⇗
- {% endif %}
- {% if item.body %}
-
+ {% if item.id %}{% endif %}
+ {% if item.link %}⇗{% endif %}
+ {% if item.body %}{{item.title}}
{{item.body|safe}}
- {% else %}
- {{item.title}}
+ {% else %}{{item.title}}
{% endif %}
- {% if item.author or item.time %}
-
- {% if item.author %}
- {{item.author}}
- {% endif %}
- {% if item.time %}
- {{item.time|datetimeformat}}
- {% endif %}
+ {% if item.author or item.time %}
+ {% if item.author %}{{item.author}}{% endif %}
+ {% if item.time %}{{item.time|datetimeformat}}{% endif %}
{% endif %}
-
- {{item.source}}
- {% if item.id %}
- {{item.id}}
- {% endif %}
- {{item.created|datetimeformat}}
+ {% if item.source or item.id or item.created %}
+ {% if item.source %}{{item.source}}{% endif %}
+ {% if item.id %}{{item.id}}{% endif %}
+ {% if item.created %}{{item.created|datetimeformat}}{% endif %}
+ {% endif %}