diff --git a/pyproject.toml b/pyproject.toml index bed423d0..1d6591e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,6 +79,7 @@ app = [ "PyYAML", # for v2 "WTForms", + "jinja2-fragments", ] # UNSTABLE PLUGINS diff --git a/src/reader/_app/v2/__init__.py b/src/reader/_app/v2/__init__.py index 4d43f331..5ed213b7 100644 --- a/src/reader/_app/v2/__init__.py +++ b/src/reader/_app/v2/__init__.py @@ -4,6 +4,7 @@ from flask import Blueprint from flask import redirect from flask import request +from jinja2_fragments.flask import render_block from .. import get_reader from .. import stream_template @@ -70,5 +71,10 @@ def mark_as(): case _: abort(422) + if request.headers.get('hx-request') == 'true': + return render_block( + 'v2/entries.html', 'entry_form', entry=reader.get_entry(entry) + ) + print(request.form['next']) return redirect(request.form['next'], code=303) diff --git a/src/reader/_app/v2/templates/v2/entries.html b/src/reader/_app/v2/templates/v2/entries.html index 213a5e52..4f254275 100644 --- a/src/reader/_app/v2/templates/v2/entries.html +++ b/src/reader/_app/v2/templates/v2/entries.html @@ -95,8 +95,12 @@

{% endif %} -
+ {% set next = loop.index if not loop.last else loop.index - 1 -%} + {#- TODO: aria stuff #} + {% block entry_form scoped %}
@@ -116,7 +122,9 @@

aria-pressed="true" {% endif -%} style="width: 2rem"> - +

@@ -143,10 +153,12 @@

- {% set next = loop.index if not loop.last else loop.index - 1 -%} + {% if next -%} + {%- endif %} + {% endblock %} diff --git a/src/reader/_app/v2/templates/v2/layout.html b/src/reader/_app/v2/templates/v2/layout.html index 102e0e7f..8a462bb9 100644 --- a/src/reader/_app/v2/templates/v2/layout.html +++ b/src/reader/_app/v2/templates/v2/layout.html @@ -14,6 +14,8 @@ + +