summaryrefslogtreecommitdiff
path: root/src/jwebmail/templates
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2024-12-08 16:15:37 +0100
committerJannis M. Hoffmann <jannis@fehcom.de>2024-12-08 16:15:37 +0100
commit57423db1e342b48c970b972a6f18e84e7a7b1a22 (patch)
tree778ecf925dfd7e04eb68edf3ebca4491ae128fcb /src/jwebmail/templates
parentbdb14d5b5fff9c53ea2684a8180f7a9e55dcc8f3 (diff)
update for mail-storage version 1.1.0
Now a keyset based pagination is used instead of an offset based one. This removes the dependency flask-paginate. URL arguments are taken from the request object in the displayheaders templates instead of passing them in manually. Not needed arguments for about render_template are removed.
Diffstat (limited to 'src/jwebmail/templates')
-rw-r--r--src/jwebmail/templates/_bot_nav.html56
-rw-r--r--src/jwebmail/templates/_folders.html6
-rw-r--r--src/jwebmail/templates/_main_table.html6
-rw-r--r--src/jwebmail/templates/_top_nav.html38
4 files changed, 89 insertions, 17 deletions
diff --git a/src/jwebmail/templates/_bot_nav.html b/src/jwebmail/templates/_bot_nav.html
index 2634151..bd9e05a 100644
--- a/src/jwebmail/templates/_bot_nav.html
+++ b/src/jwebmail/templates/_bot_nav.html
@@ -1,7 +1,43 @@
<div class="columns">
- <div class="column">
- {{ pgn.links }}
+ <div class=column>
+ <nav class="pagination" role="navigation">
+ {% if first %}
+ <a class="pagination-previous" disabled>&laquo;</a>
+ {% else %}
+ <a class="pagination-previous"
+ href="{{ url_for(
+ 'displayheaders',
+ folder=request.view_args.folder,
+ page_bound=page_bound_before,
+ page_after=0,
+ per_page=request.args.get('per_page'),
+ sort=request.args.get('sort'),
+ search=request.args.get('search'),
+ ) }}"
+ aria-label="Next">
+ &laquo;
+ </a>
+ {% endif %}
+
+ {% if last %}
+ <a class="pagination-next" disabled>&raquo;</a>
+ {% else %}
+ <a class="pagination-next"
+ href="{{ url_for(
+ 'displayheaders',
+ folder=request.view_args.folder,
+ page_bound=page_bound_after,
+ page_after=1,
+ per_page=request.args.get('per_page'),
+ sort=request.args.get('sort'),
+ search=request.args.get('search'),
+ ) }}"
+ aria-label="Next">
+ &raquo;
+ </a>
+ {% endif %}
+ </nav>
</div>
<div class="column">
@@ -9,9 +45,11 @@
{% if mail_folders|length > 1 %}
<form action="{{ url_for('move', folder=folder) }}" id="move-mail" class=is-pulled-left method=POST>
<input type=hidden name=csrf_token value="{{ csrf_token() }}">
- <input type=hidden name=sort value="{{ request.args['sort'] }}">
- <input type=hidden name=per_page value="{{ request.args['per_page'] }}">
- <input type=hidden name=page value="{{ request.args['page'] }}">
+ <input type=hidden name=sort value="{{ request.args.sort }}">
+ <input type=hidden name=search value="{{ request.args.search }}">
+ <input type=hidden name=per_page value="{{ request.args.per_page }}">
+ <input type=hidden name=page_bound value="{{ request.args.page_bound }}">
+ <input type=hidden name=after_page value="{{ request.args.after_page }}">
<div class="field has-addons">
<div class=control>
<div class=select>
@@ -35,9 +73,11 @@
method=POST class="is-pulled-left ml-2">
<input type=hidden name=csrf_token value="{{ csrf_token() }}">
- <input type=hidden name=sort value="{{ request.args['sort'] }}">
- <input type=hidden name=per_page value="{{ request.args['per_page'] }}">
- <input type=hidden name=page value="{{ request.args['page'] }}">
+ <input type=hidden name=sort value="{{ request.args.sort }}">
+ <input type=hidden name=search value="{{ request.args.search }}">
+ <input type=hidden name=per_page value="{{ request.args.per_page }}">
+ <input type=hidden name=page_bound value="{{ request.args.page_bound }}">
+ <input type=hidden name=after_page value="{{ request.args.after_page }}">
<div class=control>
<input id=remove type=submit class=button value="{{ gettext('Remove') }}">
</div>
diff --git a/src/jwebmail/templates/_folders.html b/src/jwebmail/templates/_folders.html
index fc4c21d..884188b 100644
--- a/src/jwebmail/templates/_folders.html
+++ b/src/jwebmail/templates/_folders.html
@@ -5,7 +5,7 @@
<div class="navbar-brand">
<span class=navbar-item>
- <b>{{ folder or gettext('Home') }}</b>
+ <b>{{ request.view_args.folder or gettext('Home') }}</b>
</span>
<a role="button" class="navbar-burger" data-target="navMenu" id=navbar-toggle>
<span aria-hidden="true"></span>
@@ -16,7 +16,7 @@
<div class="navbar-menu" id="navMenu">
<div class=navbar-start>
- {% for f in mail_folders if f is ne folder %}
+ {% for f in mail_folders if f is ne request.view_args.get('folder', '') %}
<a href="{{ url_for('displayheaders', folder=f, per_page=request.args.get('per_page')) }}" class="navbar-item">
{{ f or gettext('Home') }}
</a>
@@ -34,7 +34,7 @@
<div class="column is-size-7">
<div class="columns is-multiline is-mobile">
<span class="column is-half-mobile has-text-centered">
- {{ pgn.info }}
+ {{ total_mails }} Mails
</span>
{% if total_new_mails %}
<span class="column is-half-mobile has-text-centered">
diff --git a/src/jwebmail/templates/_main_table.html b/src/jwebmail/templates/_main_table.html
index cc22da4..a7801eb 100644
--- a/src/jwebmail/templates/_main_table.html
+++ b/src/jwebmail/templates/_main_table.html
@@ -3,10 +3,6 @@
{% for msg in msgs %}
<tag class="media {{ 'jwm-new-mail' if msg.unread else '' }}" id="{{ msg.message_handle }}">
- <div class="media-left is-hidden-mobile">
- {{ loop.index + (pgn.page - 1) * pgn.per_page }}
- </div>
-
<div class="media-content">
<div class="columns is-gapless is-multiline">
<div class="column is-10">
@@ -27,7 +23,7 @@
</div>
<div class="column is-10">
- <a href="{{ url_for('read', msgid=msg.message_handle, folder=folder) }}">
+ <a href="{{ url_for('read', msgid=msg.message_handle, folder=request.view_args.folder) }}">
{{ msg.head.subject or '_' }}
</a>
</div>
diff --git a/src/jwebmail/templates/_top_nav.html b/src/jwebmail/templates/_top_nav.html
index 960ae86..a9d385b 100644
--- a/src/jwebmail/templates/_top_nav.html
+++ b/src/jwebmail/templates/_top_nav.html
@@ -28,7 +28,43 @@
</form>
<div class=column>
- {{ pgn.links }}
+ <nav class="pagination" role="navigation">
+ {% if first %}
+ <a class="pagination-previous" disabled>&laquo;</a>
+ {% else %}
+ <a class="pagination-previous"
+ href="{{ url_for(
+ 'displayheaders',
+ folder=request.view_args.folder,
+ page_bound=page_bound_before,
+ page_after=0,
+ per_page=request.args.get('per_page'),
+ sort=request.args.get('sort'),
+ search=request.args.get('search'),
+ ) }}"
+ aria-label="Next">
+ &laquo;
+ </a>
+ {% endif %}
+
+ {% if last %}
+ <a class="pagination-next" disabled>&raquo;</a>
+ {% else %}
+ <a class="pagination-next"
+ href="{{ url_for(
+ 'displayheaders',
+ folder=request.view_args.folder,
+ page_bound=page_bound_after,
+ page_after=1,
+ per_page=request.args.get('per_page'),
+ sort=request.args.get('sort'),
+ search=request.args.get('search'),
+ ) }}"
+ aria-label="Next">
+ &raquo;
+ </a>
+ {% endif %}
+ </nav>
</div>
</div>