diff options
author | citrons <citrons> | 2021-06-23 08:47:09 +0000 |
---|---|---|
committer | citrons <citrons> | 2021-06-23 08:47:09 +0000 |
commit | 2cba6d4d88266aa3626d4606f2a17460c7437270 (patch) | |
tree | 19634de811b0a18d195384571c01b699211accf3 /apioforum/templates | |
parent | 47f78d820a3b31929c146a9952136c4ca9f39ce2 (diff) |
make breadcrumb work
Diffstat (limited to 'apioforum/templates')
-rw-r--r-- | apioforum/templates/common.html | 27 | ||||
-rw-r--r-- | apioforum/templates/view_thread.html | 11 |
2 files changed, 29 insertions, 9 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_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%} |