diff options
author | ubq323 <ubq323> | 2021-06-23 16:25:51 +0000 |
---|---|---|
committer | ubq323 <ubq323> | 2021-06-23 16:25:51 +0000 |
commit | ddc62e940d7c521801b9d00167acc0b0392e951a (patch) | |
tree | 35c921c6b7d531ce020eb557f9b8fc8b6cadbeb7 /apioforum/templates | |
parent | 47f78d820a3b31929c146a9952136c4ca9f39ce2 (diff) | |
parent | d6b4dcbf7699543335666c43393f6a25b23815e7 (diff) |
on second thoughts it might be easier to have this all on one branch
Diffstat (limited to 'apioforum/templates')
-rw-r--r-- | apioforum/templates/common.html | 27 | ||||
-rw-r--r-- | apioforum/templates/view_forum.html | 46 | ||||
-rw-r--r-- | apioforum/templates/view_thread.html | 11 |
3 files changed, 69 insertions, 15 deletions
diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html index 9301a49..b0bf713 100644 --- a/apioforum/templates/common.html +++ b/apioforum/templates/common.html @@ -39,3 +39,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/view_forum.html b/apioforum/templates/view_forum.html index f83503b..926980e 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -1,9 +1,42 @@ {% extends 'base.html' %} -{% from 'common.html' import ts, tag, disp_user, post_url %} -{% block header %}<h1>{% block title %}{{forum.name}}{%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 nmcontent%} <main class="widemain"> {{forum.description|md|safe}} + + +{% 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 forum_last_activity[subforum.id] %} + last activity {{ts(forum_last_activity[subforum.id])}} 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',forum_id=forum.id)}}">create new thread</a></p> {% else %} @@ -11,9 +44,9 @@ {% 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> @@ -31,7 +64,7 @@ </div> </div> {% if preview_post[thread.id] %} - <div class="thread-preview"> + <div class="listing-caption"> {{ disp_user(preview_post[thread.id].author) }} <span class="thread-preview-ts"> {{ ts(preview_post[thread.id].created) }} @@ -46,5 +79,6 @@ </div> {%endfor%} </div> + </main> {%endblock%} diff --git a/apioforum/templates/view_thread.html b/apioforum/templates/view_thread.html index ded2d52..dd41d87 100644 --- a/apioforum/templates/view_thread.html +++ b/apioforum/templates/view_thread.html @@ -1,15 +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> -<nav aria-label="Breadcrumb"> -<ol class="breadcrumbs"> - <li><a href="{{url_for('index')}}">apioforum</a></li> - <li><a href="#">the</a></li> - <li>the</li> -</ol> -</nav> - +{{ thread_breadcrumb(thread) }} {% endblock %} {%block content%} |