Commit af3e2fb9 authored by Sli's avatar Sli Committed by Skia

forum: use generic macro to display breadcrumb and display it on search result

parent 84811af9
{% extends "core/base.jinja" %}
{% from 'forum/macros.jinja' import display_forum, display_topic, display_search_bar %}
{% from 'forum/macros.jinja' import display_forum, display_breadcrumb, display_topic, display_search_bar %}
{% block title %}
{{ forum }}
{% endblock %}
{% block content %}
<div>
<a href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
{% for f in forum.get_parent_list()|reverse %}
> <a href="{{ f.get_absolute_url() }}">{{ f }}</a>
{% endfor %}
> <a href="{{ forum.get_absolute_url() }}">{{ forum }}</a>
</div>
{{ display_breadcrumb(forum) }}
<div id="forum">
<h3>{{ forum.name }}</h3>
<p>
......
......@@ -85,9 +85,20 @@
</div>
{% endmacro %}
{% macro display_breadcrumb(forum, topic="") %}
<p>
<a href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
{% for f in forum.get_parent_list()|reverse %}
> <a href="{{ f.get_absolute_url() }}">{{ f }}</a>
{% endfor %}
> <a href="{{ forum.get_absolute_url() }}">{{ forum }}</a>
{% if topic != "" %} > <a href="{{ topic.get_absolute_url() }}">{{ topic }}</a>{%- endif -%}
</p>
{% endmacro %}
{% macro display_message(m, user, unread=False) %}
{% if user.can_view(m) %}
<div id="msg_{{ m.id }}" class="message {% if unread %}unread{% endif %}">
<div id="msg_{{ m.id }}" class="message {% if unread %}unread{% endif %}">
<div class="msg_author {% if m.deleted %}deleted{% endif %}">
{% if m.author.avatar_pict %}
<img src="{{ m.author.avatar_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
......@@ -143,7 +154,7 @@
</div>
</div>
{% else %}
<div id="msg_{{ m.id }}" class="message">
<div id="msg_{{ m.id }}" class="message">
<div class="msg_author deleted">
</div>
<div class="msg_content deleted">
......
{% extends "core/base.jinja" %}
{% from 'forum/macros.jinja' import display_message, display_search_bar %}
{% from 'forum/macros.jinja' import display_message, display_breadcrumb, display_search_bar %}
{% block content %}
<div id="forum">
......@@ -9,6 +9,7 @@
<br>
<div class="search-results">
{% for m in object_list %}
{{ display_breadcrumb(m.topic.forum, m.topic) }}
{{ display_message(m, user) }}
{% endfor %}
</div>
......
{% extends "core/base.jinja" %}
{% from 'core/macros.jinja' import user_profile_link %}
{% from 'forum/macros.jinja' import display_message, display_search_bar %}
{% from 'forum/macros.jinja' import display_message, display_breadcrumb, display_search_bar %}
{% block title %}
{{ topic }}
......@@ -26,16 +26,8 @@
{% endblock %}
{% block content %}
<p>
{{ display_search_bar(request) }}
<a href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
{% for f in topic.forum.get_parent_list()|reverse %}
> <a href="{{ f.get_absolute_url() }}">{{ f }}</a>
{% endfor %}
> <a href="{{ topic.forum.get_absolute_url() }}">{{ topic.forum }}</a>
> <a href="{{ topic.get_absolute_url() }}">{{ topic }}</a>
</p>
<h3>{{ topic.title }}</h3>
{{ display_breadcrumb(topic.forum, topic) }}
<h3>{{ topic.title }}</h3>
<div id="forum">
<p>{{ topic.description }}</p>
<p>
......@@ -47,6 +39,7 @@
{% endif %}
</p>
{{ display_search_bar(request) }}
<p style="text-align: right; background: #d8e7f3;">
{% for p in msgs.paginator.page_range %}
<span class="ib" style="background: {% if p == msgs.number %}white{% endif %}; margin: 0;"><a href="?page={{ p }}">{{ p }}</a></span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment