Add Forum

This commit is contained in:
Skia
2017-01-21 03:42:06 +01:00
parent fcaa740710
commit ea52462217
19 changed files with 449 additions and 1 deletions

View File

@ -0,0 +1,44 @@
{% 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 %}
{% block content %}
<p>{{ forum.get_parent_list() }}</p>
<h3>{{ forum.name }}</h3>
<a href="{{ url('forum:new_forum') }}?parent={{ forum.id }}">New forum</a>
{% for f in forum.children.all() %}
{{ display_forum(f) }}
{% endfor %}
{% for t in forum.topics.all() %}
<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>
</div>
{% endfor %}
<a href="{{ url('forum:new_topic', forum_id=forum.id) }}">New topic</a>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% 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>
</div>
{% endmacro %}

View File

@ -0,0 +1,33 @@
{% extends "core/base.jinja" %}
{% 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 %}
<h3>{% trans %}Forum{% endtrans %}</h3>
<a href="{{ url('forum:new_forum') }}">New forum</a>
{% for f in forum_list %}
<div style="padding: 4px; margin: 4px">
{{ display_forum(f) }}
{% for c in f.children.all() %}
{{ display_forum(c) }}
{% endfor %}
</div>
{% endfor %}
{% endblock %}

View File

@ -0,0 +1,38 @@
{% extends "core/base.jinja" %}
{% 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 %}
{% block content %}
<h3>{{ topic.title }}</h3>
<p>{{ topic.description }}</p>
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">Reply</a></p>
{% for m in topic.messages.all() %}
<div>
<h5>{{ m.title }}</h5>
<p><strong>{{ m.author.get_display_name() }}</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>
{% endfor %}
{% endblock %}