Skip to content

Commit

Permalink
Refactor the /tags template a bit.
Browse files Browse the repository at this point in the history
For #185.
  • Loading branch information
lemon24 committed Nov 28, 2020
1 parent f352597 commit cec4634
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/reader/_app/__init__.py
Expand Up @@ -402,7 +402,8 @@ def entry():
@blueprint.route('/tags')
def tags():
reader = get_reader()
return render_template('tags.html', tags=reader.get_feed_tags())
tags = itertools.chain([True, False], reader.get_feed_tags())
return render_template('tags.html', tags=tags)


form_api = APIThing(blueprint, '/form-api', 'form_api')
Expand Down
17 changes: 5 additions & 12 deletions src/reader/_app/templates/tags.html
Expand Up @@ -24,23 +24,16 @@

<ul>

<li>
<p>
<a href="{{ url_for('.feeds', tags=[true] | tojson) }}">feeds</a> or
<a href="{{ url_for('.entries', tags=[true] | tojson) }}">entries</a>
with any tags
<li>
<p>
<a href="{{ url_for('.feeds', tags=[false] | tojson) }}">feeds</a> or
<a href="{{ url_for('.entries', tags=[false] | tojson) }}">entries</a>
with no tags

{% for tag in tags %}
<li id="tag-{{ loop.index }}">
<p>
<a href="{{ url_for('.feeds', tags=[tag] | tojson) }}">feeds</a> or
<a href="{{ url_for('.entries', tags=[tag] | tojson) }}">entries</a>
with <span class="tag">{{ tag }}</span>
with
{% if tag is true %} any tags
{% elif tag is false %} no tags
{% else %} <span class="tag">{{ tag }}</span>
{% endif %}
{% else %}

{% if not error %}
Expand Down

0 comments on commit cec4634

Please sign in to comment.