diff options
author | citrons <citrons> | 2021-07-11 03:39:15 +0000 |
---|---|---|
committer | citrons <citrons> | 2021-07-11 03:39:15 +0000 |
commit | 183061d9a17e3613db2063ccd291af3fac904f11 (patch) | |
tree | b465e064566cac6803e1993bbc6a1ec808c4c490 /apioforum/templates | |
parent | 8d2d7a54ee496224061d03bd81432688b14c1eb3 (diff) | |
parent | 4bb33e0c18b45ae0cc0f87438c8e0432cf6250c1 (diff) |
merge looks good
Diffstat (limited to 'apioforum/templates')
-rw-r--r-- | apioforum/templates/base.html | 2 | ||||
-rw-r--r-- | apioforum/templates/common.html | 27 | ||||
-rw-r--r-- | apioforum/templates/create_thread.html | 2 | ||||
-rw-r--r-- | apioforum/templates/view_forum.html | 64 | ||||
-rw-r--r-- | apioforum/templates/view_thread.html | 3 |
5 files changed, 80 insertions, 18 deletions
diff --git a/apioforum/templates/base.html b/apioforum/templates/base.html index 33e49f6..9cfd7f3 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> + <nav id="navbar"> <p style="font-family: monospace;"><b>apio</b><i>forum</i>™</p> <form class="search-form" action="/search"> <input type="search" placeholder="query" name="q"> diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html index 3321085..44cfbce 100644 --- a/apioforum/templates/common.html +++ b/apioforum/templates/common.html @@ -49,3 +49,30 @@ {% macro tag(the_tag) -%} <span class="tag" style="color: {{the_tag.text_colour}}; background-color: {{the_tag.bg_colour}}">{{the_tag.name}}</span> {%- endmacro %} + +{% macro breadcrumb() %} +<nav aria-label="Breadcrumb"> +<ol class="breadcrumbs"> + {{- caller() -}} +</ol> +</nav> +{% endmacro %} + +{% macro forum_bc_entries(forum_id) -%} + {%- for f in forum_path(forum_id) -%} + <li><a href="{{url_for('forum.view_forum',forum_id=f.id)}}">{{ f.name }}</a></li> + {%- endfor %} +{%- endmacro %} + +{% macro forum_breadcrumb(forum) %} + {%- call breadcrumb() %} + {{ forum_bc_entries(forum.id) }} + {% endcall -%} +{% endmacro %} + +{% macro thread_breadcrumb(thread) %} + {%- call breadcrumb() %} + {{ forum_bc_entries(thread.forum) }} + <li>{{ thread.title }}</li> + {% endcall -%} +{% endmacro %} diff --git a/apioforum/templates/create_thread.html b/apioforum/templates/create_thread.html index 9de7312..04b4f42 100644 --- a/apioforum/templates/create_thread.html +++ b/apioforum/templates/create_thread.html @@ -4,7 +4,7 @@ {% endblock %} {% block content %} -<form action="{{url_for('forum.create_thread')}}", method="POST"> +<form method="POST"> <label for="title">thread title</label> <input name="title" id="title"> <br> diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html index b27088d..d075d85 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -1,19 +1,52 @@ {% extends 'base.html' %} -{% from 'common.html' import ts, tag, disp_user, post_url %} -{% block header %}<h1>{% block title %}apioforum{%endblock%}</h1>{%endblock%} +{% from 'common.html' import ts, tag, disp_user, post_url, forum_breadcrumb %} +{% block header %} +<h1>{% block title %}{{forum.name}}{%endblock%}</h1> +{% if forum.id != 1 %} + {{ forum_breadcrumb(forum) }} +{% endif %} +{%endblock%} + {%block content%} -<p>welcome to the apioforum</p> -<p>forum rules: do not be a bad person. do not do bad things.</p> +{% if forum.description %} +{{forum.description|md|safe}} +{% endif %} + +{% if subforums %} +<h2>subforae</h2> +<div class="forum-list"> + {% for subforum in subforums %} + <div class="listing"> + <div class="listing-main"> + <div class="listing-title"> + <a href="{{url_for('forum.view_forum',forum_id=subforum.id)}}"> + {{- subforum.name -}} + </a> + </div> + </div> + <div class="listing-caption"> + {% if subforum.updated %} + last activity {{ts(subforum.updated)}} ago + {% else %} + no threads + {% endif %} + </div> + </div> + {% endfor %} +</div> +{% endif %} + +<h2>threads</h2> {% if g.user %} -<p><a class="actionbutton" href="{{url_for('forum.create_thread')}}">create new thread</a></p> +<p><a class="actionbutton" href="{{url_for('forum.create_thread',forum_id=forum.id)}}">create new thread</a></p> {% else %} <p>please log in to create a new thread</p> {% endif %} <div class="thread-list"> {%for thread in threads%} - <div class="thread-listing"> - <div class="thread-listing-main"> - <div class="thread-listing-title"> + <div class="listing"> + <div class="listing-main"> + <div class="listing-title"> <a href="{{url_for('thread.view_thread',thread_id=thread.id)}}"> {{- thread.title -}} </a> @@ -30,20 +63,21 @@ {{ ts(thread.created) }} </div> </div> - {% if preview_post[thread.id] %} - <div class="thread-preview"> - {{ disp_user(preview_post[thread.id].author) }} + {#{% if thread.mrp_id %}#} + <div class="listing-caption"> + {{ disp_user(thread.mrp_author) }} <span class="thread-preview-ts"> - {{ ts(preview_post[thread.id].created) }} + {{ ts(thread.mrp_created) }} </span> <span class="thread-preview-post"> - <a href="{{post_url(preview_post[thread.id])}}"> - {{ preview_post[thread.id].content[:500]|e }} + <a href="{{url_for('thread.view_thread',thread_id=thread.id)}}#post_{{thread.mrp_id}}"> + {{ thread.mrp_content[:500]|e }} </a> </span> </div> - {% endif %} + {#{% endif %}#} </div> {%endfor%} </div> +</main> {%endblock%} diff --git a/apioforum/templates/view_thread.html b/apioforum/templates/view_thread.html index 7bf253d..d4a43ef 100644 --- a/apioforum/templates/view_thread.html +++ b/apioforum/templates/view_thread.html @@ -1,7 +1,8 @@ -{% from 'common.html' import disp_post,tag %} +{% from 'common.html' import disp_post,tag,thread_breadcrumb %} {% extends 'base.html' %} {% block header %} <h1>{%block title %}{{thread.title}}{% endblock %}</h1> +{{ thread_breadcrumb(thread) }} {% endblock %} {%block content%} |