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" %} {% 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 %} {% block title %}
{{ forum }} {{ forum }}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div> {{ display_breadcrumb(forum) }}
<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>
<div id="forum"> <div id="forum">
<h3>{{ forum.name }}</h3> <h3>{{ forum.name }}</h3>
<p> <p>
......
...@@ -85,9 +85,20 @@ ...@@ -85,9 +85,20 @@
</div> </div>
{% endmacro %} {% 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) %} {% macro display_message(m, user, unread=False) %}
{% if user.can_view(m) %} {% 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 %}"> <div class="msg_author {% if m.deleted %}deleted{% endif %}">
{% if m.author.avatar_pict %} {% if m.author.avatar_pict %}
<img src="{{ m.author.avatar_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" id="picture" /> <img src="{{ m.author.avatar_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
...@@ -143,7 +154,7 @@ ...@@ -143,7 +154,7 @@
</div> </div>
</div> </div>
{% else %} {% else %}
<div id="msg_{{ m.id }}" class="message"> <div id="msg_{{ m.id }}" class="message">
<div class="msg_author deleted"> <div class="msg_author deleted">
</div> </div>
<div class="msg_content deleted"> <div class="msg_content deleted">
......
{% extends "core/base.jinja" %} {% 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 %} {% block content %}
<div id="forum"> <div id="forum">
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<br> <br>
<div class="search-results"> <div class="search-results">
{% for m in object_list %} {% for m in object_list %}
{{ display_breadcrumb(m.topic.forum, m.topic) }}
{{ display_message(m, user) }} {{ display_message(m, user) }}
{% endfor %} {% endfor %}
</div> </div>
......
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{% from 'core/macros.jinja' import user_profile_link %} {% 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 %} {% block title %}
{{ topic }} {{ topic }}
...@@ -26,16 +26,8 @@ ...@@ -26,16 +26,8 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<p> {{ display_breadcrumb(topic.forum, topic) }}
{{ display_search_bar(request) }} <h3>{{ topic.title }}</h3>
<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>
<div id="forum"> <div id="forum">
<p>{{ topic.description }}</p> <p>{{ topic.description }}</p>
<p> <p>
...@@ -47,6 +39,7 @@ ...@@ -47,6 +39,7 @@
{% endif %} {% endif %}
</p> </p>
{{ display_search_bar(request) }}
<p style="text-align: right; background: #d8e7f3;"> <p style="text-align: right; background: #d8e7f3;">
{% for p in msgs.paginator.page_range %} {% 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> <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