Some other great forum improvements

This commit is contained in:
Skia
2017-01-21 22:47:30 +01:00
parent 93f5096140
commit 653d9d4707
7 changed files with 106 additions and 34 deletions

View File

@ -3,13 +3,13 @@
{% from 'core/macros.jinja' import user_profile_link %}
{% block content %}
<p>
<div>
<a href="{{ url('forum:main') }}">Forum</a>
{% for f in forum.get_parent_list() %}
> <a href="{{ f.get_absolute_url() }}">{{ f }}</a>
{% endfor %}
> <a href="{{ forum.get_absolute_url() }}">{{ forum }}</a>
</p>
</div>
<h3>{{ forum.name }}</h3>
<a href="{{ url('forum:new_forum') }}?parent={{ forum.id }}">New forum</a>
{% for f in forum.children.all() %}
@ -17,19 +17,31 @@
{% endfor %}
{% for t in topics %}
<div class="topic">
<p>
<a href="{{ url('forum:edit_topic', topic_id=t.id) }}">Edit</a>
</p>
<a href="{{ url('forum:view_topic', topic_id=t.id) }}">
<div style="display: inline-block; width: 80%">
<h5>{{ t.title }}</h5>
<p>{{ t.description }}</p>
<div class="ib w_medium">
<a class="ib w_big" href="{{ url('forum:view_topic', topic_id=t.id) }}">
<h5>{{ t.title }}</h5>
<p>{{ t.description }}</p>
</a>
{% if user.can_edit(t) %}
<div class="ib" style="text-align: center;">
<a href="{{ url('forum:edit_topic', topic_id=t.id) }}">Edit</a>
</div>
{% endif %}
</div>
</a>
<div style="display: inline-block; width: 19%">
{% set last_msg = t.messages.order_by('id').last() %}
<p>Last message by {{ user_profile_link(last_msg.author) }} at {{ last_msg.date|date(DATETIME_FORMAT) }} {{
last_msg.date|time(DATETIME_FORMAT) }}</p>
<div class="ib w_medium">
<div class="ib w_medium">
<div class="ib w_medium" style="text-align: center;">
{{ user_profile_link(t.author) }}
</div>
<div class="ib w_medium" style="text-align: center;">
{{ t.messages.count() }}
</div>
</div>
<div class="ib w_medium" style="text-align: center;">
{% set last_msg = t.messages.order_by('id').last() %}
{{ user_profile_link(last_msg.author) }} <br/>
{{ last_msg.date|date(DATETIME_FORMAT) }} {{ last_msg.date|time(DATETIME_FORMAT) }}
</div>
</div>
</div>
{% endfor %}

View File

@ -1,17 +1,33 @@
{% macro display_forum(forum) %}
<div class="forum {% if forum.is_category %}category{% endif %}">
<p>
<a href="{{ url('forum:edit_forum', forum_id=forum.id) }}">Edit</a>
</p>
{% if not forum.is_category %}
<a href="{{ url('forum:view_forum', forum_id=forum.id) }}">
{% endif %}
<div>
<h5>{{ forum.name }}</h5>
<p>{{ forum.description }}</p>
<div class="ib w_big">
{% if not forum.is_category %}
<a class="ib w_big" href="{{ url('forum:view_forum', forum_id=forum.id) }}">
{% else %}
<div class="ib w_big">
{% endif %}
<h5>{{ forum.name }}</h5>
<p>{{ forum.description }}</p>
{% if not forum.is_category %}
</a>
{% else %}
</div>
{% endif %}
<a class="ib" href="{{ url('forum:edit_forum', forum_id=forum.id) }}">Edit</a>
</div>
{% if not forum.is_category %}
</a>
<div class="ib w_small">
<div class="ib w_medium">
{{ forum.get_topic_number() }}
</div>
<div class="ib w_medium">
{% set last_msg = forum.get_last_message() %}
{% if last_msg %}
{{ last_msg.author }} <br/>
{{ last_msg.date|date(DATETIME_FORMAT) }} {{ last_msg.date|time(DATETIME_FORMAT) }}
{% endif %}
</div>
</div>
{% endif %}
</div>
{% endmacro %}

View File

@ -40,21 +40,25 @@
{% else %}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
{% endif %}
<br/>
<strong>{{ user_profile_link(m.author) }}</strong>
</div>
<div style="display: inline-block; width: 80%;">
<div style="display: inline-block; width: 80%; vertical-align: top;">
<div style="display: inline-block; width: 74%;">
{% if m.title %}
<h5>{{ m.title }}</h5>
<hr>
{% endif %}
</div>
<div style="display: inline-block; width: 25%;">
<span> <a href="{{ url('forum:edit_message', message_id=m.id) }}">{% trans %}Edit{% endtrans %}</a></span>
<span><a href="{{ url('forum:new_message', topic_id=topic.id) }}?quote_id={{ m.id }}">
{% trans %}Reply as quote{% endtrans %}</a></span><br/>
{% trans %}Reply as quote{% endtrans %}</a></span>
{% if user.can_edit(m) %}
<span> <a href="{{ url('forum:edit_message', message_id=m.id) }}">{% trans %}Edit{% endtrans %}</a></span>
{% endif %}
<br/>
<span>{{ m.date|date(DATETIME_FORMAT) }} {{ m.date|time(DATETIME_FORMAT) }}</span>
</div>
<hr>
<div>
{{ m.message|markdown }}
</div>