aboutsummaryrefslogtreecommitdiffhomepage
path: root/apioforum/templates
diff options
context:
space:
mode:
authorubq323 <ubq323>2021-08-25 21:46:00 +0000
committerubq323 <ubq323>2021-08-25 21:46:00 +0000
commit3b5a5ceb9258f32b4650575fdce3bd5e88f04caf (patch)
tree19015c5908b97bfc1717edd32c8a0c6261adadc7 /apioforum/templates
parent04419408ad669f9093149697bf9abb7591d29b23 (diff)
parent510ecff54b74ab98bd8d8efcd0a3c1a99e979fb0 (diff)
merge pagination into webhooks
Diffstat (limited to 'apioforum/templates')
-rw-r--r--apioforum/templates/base.html2
-rw-r--r--apioforum/templates/common.html20
-rw-r--r--apioforum/templates/view_forum.html9
-rw-r--r--apioforum/templates/view_post.html2
-rw-r--r--apioforum/templates/view_thread.html3
5 files changed, 25 insertions, 11 deletions
diff --git a/apioforum/templates/base.html b/apioforum/templates/base.html
index ca1dd87..b97117f 100644
--- a/apioforum/templates/base.html
+++ b/apioforum/templates/base.html
@@ -10,7 +10,7 @@
<link rel="icon" href="//gh0.pw/favicon.ico">
</head>
<body>
- <nav id="navbar">
+ <nav aria-label="main" id="navbar">
<p style="font-family: monospace;"><b>apio</b><i>forum</i>&trade;</p>
<form class="inline-form" action="/search">
<input type="search" placeholder="query" name="q">
diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html
index f6b6f29..8eeef70 100644
--- a/apioforum/templates/common.html
+++ b/apioforum/templates/common.html
@@ -2,10 +2,6 @@
<a href="{{url_for('user.view_user',username=username)}}" class="username">{{username}}</a>
{%- endmacro %}
-{% macro post_url(post) -%}
- {{url_for('thread.view_thread', thread_id=post.thread)}}#post_{{post.id}}
-{%- endmacro %}
-
{% macro disp_post(post, buttons=False, forum=None, footer=None) %}
<div class="post {% if post.deleted %}deleted-post{% endif %}" id="post_{{post.id}}">
<div class="post-heading">
@@ -49,7 +45,7 @@
href="{{url_for('thread.view_post',post_id=post.id)}}">src</a>
{% endif %}
- <a class="post-anchor-link" href="{{post_url(post)}}">#{{post.id}}</a>
+ <a class="post-anchor-link" href="{{post_jump(post.id)}}">#{{post.id}}</a>
</span>
</div>
<div class="post-content md">
@@ -142,3 +138,17 @@
</desc>
</svg>
{% endmacro %}
+
+{% macro pagination_nav(page,max_pageno,view) %}
+<nav aria-label="pagination" id="pages">
+ {% if page > 1 %}
+ <a href="{{url_for(view,**kwargs)}}" aria-label="first page">&lt;&lt;</a>
+ <a href="{{url_for(view,page=page-1,**kwargs)}}" aria-label="previous page">&lt;</a>
+ {% endif %}
+ page {{page}} of {{max_pageno}}
+ {% if page < max_pageno %} {# > #}
+ <a href="{{url_for(view,page=page+1,**kwargs)}}" aria-label="next page">&gt;</a>
+ <a href="{{url_for(view,page=max_pageno,**kwargs)}}" aria-label="last page">&gt;&gt;</a>
+ {% endif %}
+</nav>
+{% endmacro %}
diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html
index 0eada1a..75144c8 100644
--- a/apioforum/templates/view_forum.html
+++ b/apioforum/templates/view_forum.html
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
-{% from 'common.html' import ts, tag, disp_user, post_url, forum_breadcrumb, ab, vote_meter %}
+{% from 'common.html' import ts, tag, disp_user, post_url, forum_breadcrumb, ab, vote_meter, pagination_nav %}
{% block header %}
<h1>{% block title %}{{forum.name}}{% endblock %} <span class="thing-id">#{{forum.id}}</span></h1>
{% if forum.id != 1 %}
@@ -112,7 +112,7 @@ you do not have permission to create threads in this forum
{{ ts(thread.mrp_created) }}
</span>
<span class="thread-preview-post">
- <a href="{{url_for('thread.view_thread',thread_id=thread.id)}}#post_{{thread.mrp_id}}">
+ <a href="{{post_jump(thread.mrp_id)}}">
{{ thread.mrp_content[:500]|e }}
</a>
</span>
@@ -120,7 +120,7 @@ you do not have permission to create threads in this forum
{% else %}
<div class="listing-caption">
<a class="thread-preview-post"
- href="{{url_for('thread.view_thread',thread_id=thread.id)}}#post_{{thread.mrp_id}}">
+ href="{{post_jump(thread.mrp_id)}}">
latest post
</a>
</div>
@@ -133,6 +133,9 @@ you do not have permission to create threads in this forum
</div>
{%endfor%}
</div>
+{{ pagination_nav(page,max_pageno,'forum.view_forum',forum_id=forum.id) }}
+
+
{% else %}
<p>you do not have permission to view threads in this forum</p>
{% endif %}
diff --git a/apioforum/templates/view_post.html b/apioforum/templates/view_post.html
index 993c005..fcaf29b 100644
--- a/apioforum/templates/view_post.html
+++ b/apioforum/templates/view_post.html
@@ -8,5 +8,5 @@
{{disp_post(post,False)}}
<p>post source:</p>
<textarea readonly class="new-post-box" name="newcontent">{{post.content}}</textarea>
-<a href="{{url_for('thread.view_thread',thread_id=post.thread)}}">i am satisfied</a>
+<a href="{{post_jump(post.id)}}">i am satisfied</a>
{% endblock %}
diff --git a/apioforum/templates/view_thread.html b/apioforum/templates/view_thread.html
index 132fd44..fe22cfc 100644
--- a/apioforum/templates/view_thread.html
+++ b/apioforum/templates/view_thread.html
@@ -1,4 +1,4 @@
-{% from 'common.html' import disp_post,tag,thread_breadcrumb,vote_meter %}
+{% from 'common.html' import disp_post,tag,thread_breadcrumb,vote_meter,pagination_nav %}
{% extends 'base.html' %}
{% block header %}
<h1>{%block title %}{{thread.title}}{% endblock %} <span class="thing-id">#{{thread.id}}</span></h1>
@@ -69,6 +69,7 @@
{% endif %}
{% endfor %}
</div>
+{{ pagination_nav(page,max_pageno,'thread.view_thread',thread_id=thread.id) }}
{% if g.user and has_permission(thread.forum, g.user, "p_reply_threads") %}
<form class="new-post" action="{{url_for('thread.create_post',thread_id=thread.id)}}" method="POST">
<textarea class="new-post-box" placeholder="your post here..." name="content"></textarea>