Skip to content

Commit

Permalink
v2: feed entries. #318
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon24 committed Jan 16, 2025
1 parent 60d1e83 commit 9af682a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
13 changes: 11 additions & 2 deletions src/reader/_app/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ def entries():
# TODO: search
# TODO: if search/tags is active, search/tags box should not be hidden
# TODO: highlight active filter preset + uncollapse more
# TODO: feed filter
# TODO: paqgination
# TODO: read time

form = EntryFilter(request.args)
kwargs = dict(form.data)
del kwargs['search']

feed = None
if form.feed.data:
feed = reader.get_feed(form.feed.data, None)
if not feed:
abort(404)

get_entries = reader.get_entries

if form.validate():
Expand All @@ -41,7 +46,11 @@ def entries():
entries = []

return stream_template(
'v2/entries.html', presets=ENTRY_FILTER_PRESETS, form=form, entries=entries
'v2/entries.html',
presets=ENTRY_FILTER_PRESETS,
form=form,
entries=entries,
feed=feed,
)


Expand Down
2 changes: 2 additions & 0 deletions src/reader/_app/v2/forms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import yaml
from wtforms import Form
from wtforms import HiddenField
from wtforms import RadioField
from wtforms import SearchField
from wtforms import StringField
Expand Down Expand Up @@ -73,6 +74,7 @@ def radio_field(*args, choices, **kwargs):


class EntryFilter(ToFormdataMixin, Form):
feed = HiddenField("feed")
search = SearchField("search", name='q')
feed_tags = TagFilterField("tags", name='tags')
read = radio_field("read", choices=BOOL_CHOICES, default='no')
Expand Down
24 changes: 21 additions & 3 deletions src/reader/_app/v2/templates/v2/entries.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,27 @@
{% import "v2/macros.html" as macros %}


{% block page_title %}Entries{% endblock %}
{% block page_title %}
{% if not feed %}
Entries
{% else %}
{{ feed.resolved_title or feed.url }}
{% endif %}
- reader
{% endblock %}

{% block main_title %}
{% if not feed %}
Entries
{% else %}
<span {% if feed.title and feed.resolved_title != feed.title -%}
title="{{ feed.title }}"
{%- endif %}>
{{ feed.resolved_title or feed.url }}
</span>
{% endif %}
{% endblock %}

{% block main_title %}Entries{% endblock %}

{% block body %}

Expand Down Expand Up @@ -51,7 +69,7 @@
<ul class="list-inline" style="margin-bottom: 0.125rem">

<li class="list-inline-item">
<a class="text-decoration-none" href="{{ url_for('reader.entries', feed=entry.feed.url) }}">
<a class="text-decoration-none" href="{{ url_for('.entries', feed=entry.feed.url) }}">
<small>
{{ entry.feed_resolved_title or 'untitled feed' }}
</small>
Expand Down

0 comments on commit 9af682a

Please sign in to comment.