Improve forum style and templates

This commit is contained in:
Skia
2017-01-21 12:28:32 +01:00
parent ff77df3646
commit 93f5096140
7 changed files with 98 additions and 49 deletions

View File

@ -1,24 +1,6 @@
{% extends "core/base.jinja" %}
{% from 'forum/macros.jinja' import display_forum %}
{% block head %}
{{ super() }}
<style type="text/css" media="all">
.topic {
border: solid skyblue 1px;
padding: 2px;
margin: 2px;
}
.forum {
background: lightblue;
padding: 2px;
margin: 2px;
}
.category {
background: skyblue;
}
</style>
{% endblock %}
{% from 'core/macros.jinja' import user_profile_link %}
{% block content %}
<p>
@ -33,14 +15,22 @@
{% for f in forum.children.all() %}
{{ display_forum(f) }}
{% endfor %}
{% for t in forum.topics.all() %}
{% for t in topics %}
<div class="topic">
<p>
<a href="{{ url('forum:view_topic', topic_id=t.id) }}">View</a>
<a href="{{ url('forum:edit_topic', topic_id=t.id) }}">Edit</a>
</p>
<h5>{{ t.title }}</h5>
<p>{{ t.description }}</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>
</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>
</div>
{% endfor %}
<a href="{{ url('forum:new_topic', forum_id=forum.id) }}">New topic</a>

View File

@ -1,13 +1,18 @@
{% macro display_forum(forum) %}
<div class="forum {% if forum.is_category %}category{% endif %}">
<p>
{% if not forum.is_category %}
<a href="{{ url('forum:view_forum', forum_id=forum.id) }}">View</a>
{% endif %}
<a href="{{ url('forum:edit_forum', forum_id=forum.id) }}">Edit</a>
</p>
<h5>{{ forum.name }}</h5>
<p>{{ forum.description }}</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>
{% if not forum.is_category %}
</a>
{% endif %}
</div>
{% endmacro %}

View File

@ -2,20 +2,6 @@
{% from 'core/macros.jinja' import user_profile_link %}
{% from 'forum/macros.jinja' import display_forum %}
{% block head %}
{{ super() }}
<style type="text/css" media="all">
.forum {
background: lightblue;
padding: 2px;
margin: 2px;
}
.category {
background: skyblue;
}
</style>
{% endblock %}
{% block content %}
<p>
<a href="{{ url('forum:main') }}">Forum</a> >

View File

@ -33,13 +33,32 @@
<p>{{ topic.description }}</p>
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">Reply</a></p>
{% for m in topic.messages.all() %}
<hr>
<div>
<h5>{{ m.title }}</h5>
<p><strong>{{ user_profile_link(m.author) }}</strong> - {{ m.date|date(DATETIME_FORMAT) }}
{{ m.date|time(DATETIME_FORMAT) }} -
<a href="{{ url('forum:new_message', topic_id=topic.id) }}?quote_id={{ m.id }}">Reply as quote</a></p>
<p>{{ m.message|markdown }}</p>
<div class="message">
<div class="msg_author">
{% if m.author.profile_pict %}
<img src="{{ m.author.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
{% else %}
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
{% endif %}
<strong>{{ user_profile_link(m.author) }}</strong>
</div>
<div style="display: inline-block; width: 80%;">
<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/>
<span>{{ m.date|date(DATETIME_FORMAT) }} {{ m.date|time(DATETIME_FORMAT) }}</span>
</div>
<div>
{{ m.message|markdown }}
</div>
</div>
</div>
{% endfor %}
{% endblock %}