Implement a basic forum
This commit is contained in:
@@ -32,7 +32,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="nav" class="grid_12">
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="{%url forums.views.index%}">Forums</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content" class="grid_12">
|
||||
<h1>{%block sectiontitle %}Caminus{%endblock%}</h1>
|
||||
{% block breadcrumb %}{% endblock %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
2
templates/forum_base.html
Normal file
2
templates/forum_base.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{% extends "base.html" %}
|
||||
{% block sectiontitle %}Forums{% endblock %}
|
1
templates/forums/_breadcrumb.html
Normal file
1
templates/forums/_breadcrumb.html
Normal file
@@ -0,0 +1 @@
|
||||
{%block breadcrumb %}
|
15
templates/forums/_forum_table.html
Normal file
15
templates/forums/_forum_table.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% load mptt_tags %}
|
||||
<table>
|
||||
<tr class="header">
|
||||
<th>Name</th>
|
||||
<th>Topics</th>
|
||||
<th>Last Post</th>
|
||||
</tr>
|
||||
{% for f in forums %}
|
||||
<tr class="{% cycle 'even' 'odd' %}">
|
||||
<td><a href="{{ f.get_absolute_url }}">{{ f.name }}</a></td>
|
||||
<td>{{ f.topicCount }}</td>
|
||||
<td>Today</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
11
templates/forums/_post.html
Normal file
11
templates/forums/_post.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% load mptt_tags %}
|
||||
|
||||
<div class="forum-post">
|
||||
{% include "forums/_post_children.html" with post=post %}
|
||||
{% recursetree post.children %}
|
||||
<div class="forum-post">
|
||||
{% include "forums/_post_children.html" with post=node %}
|
||||
{{children}}
|
||||
</div>
|
||||
{%endrecursetree%}
|
||||
</div>
|
13
templates/forums/_post_children.html
Normal file
13
templates/forums/_post_children.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{% load markup %}
|
||||
{% load avatar_tags %}
|
||||
|
||||
<a name="reply-{{post.id}}"></a>
|
||||
<div class="forum-post-user">
|
||||
{%avatar post.user%}
|
||||
{{post.user}}
|
||||
</div>
|
||||
<div class="forum-post-content">
|
||||
{{post.body|markdown:"safe"}}
|
||||
<br style="clear:both"/>
|
||||
</div>
|
||||
<a href="{%url forums.views.reply post.id%}">Reply</a>
|
29
templates/forums/forum.html
Normal file
29
templates/forums/forum.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{% extends "forum_base.html" %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
<a href="{% url forums.views.index%}">Forums</a>
|
||||
{%for f in forum.get_ancestors %}
|
||||
> <a href="{{f.get_relative_url}}">{{f}}</a>
|
||||
{%endfor%}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>{{ forum.name }}</h2>
|
||||
{%include "forums/_forum_table.html" with forums=forums.children%}
|
||||
<table>
|
||||
<tr class="header">
|
||||
<th>Title</th>
|
||||
<th>Posted</th>
|
||||
<th>Latest Activity</th>
|
||||
</tr>
|
||||
{% for topic in topics %}
|
||||
<tr class="{%cycle 'even' 'odd' %}">
|
||||
<td><a href="{{topic.get_absolute_url}}">{{ topic.title }}</a></td>
|
||||
<td>{{ topic.created }} </td>
|
||||
<td>{{topic.lastPost.created}} by {{ topic.lastPost.user }} </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<a href="{%url forums.views.newTopic forumID=forum.id %}">New Topic</a>
|
||||
{% endblock %}
|
7
templates/forums/forum_base.html
Normal file
7
templates/forums/forum_base.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% block breadcrumb %}
|
||||
{% endblock breadcrumb %}
|
||||
|
||||
{% endblock content%}
|
7
templates/forums/index.html
Normal file
7
templates/forums/index.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{% extends "forum_base.html" %}
|
||||
|
||||
{%block title %}Forums{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{%include "forums/_forum_table.html" with forums=forums%}
|
||||
{%endblock%}
|
17
templates/forums/newTopic.html
Normal file
17
templates/forums/newTopic.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends "forum_base.html" %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
<a href="{% url forums.views.index%}">Forums</a>
|
||||
{%for f in forum.get_ancestors %}
|
||||
> <a href="{{f.get_relative_url}}">{{f}}</a>
|
||||
{%endfor%}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form method="POST" action="{%url forums.views.newTopic forumID=forum.id %}">
|
||||
{% csrf_token %}
|
||||
{{topicForm.as_p}}
|
||||
{{replyForm.as_p}}
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
{% endblock %}
|
8
templates/forums/reply.html
Normal file
8
templates/forums/reply.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% extends "forum_base.html" %}
|
||||
{%block content%}
|
||||
<form method="POST" action="{%url forums.views.reply post.id %}">
|
||||
{% csrf_token %}
|
||||
{{form.as_p}}
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
{%endblock%}
|
17
templates/forums/topic.html
Normal file
17
templates/forums/topic.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends "forum_base.html" %}
|
||||
{% load mptt_tags %}
|
||||
{%block title %}{{topic.title}}{%endblock%}
|
||||
|
||||
{%block breadcrumb %}
|
||||
<a href="{% url forums.views.index%}">Forums</a>
|
||||
|
||||
> <a href="{{topic.forum.get_absolute_url}}">{{topic.forum}}</a>
|
||||
{%for f in topic.forum.get_ancestors %}
|
||||
> <a href="{{f.get_relative_url}}">{{f}}</a>
|
||||
{%endfor%}
|
||||
{%endblock%}
|
||||
|
||||
{%block content %}
|
||||
<h2>{{topic.title}}</h2>
|
||||
{% include "forums/_post.html" with post=topic.rootPost %}
|
||||
{%endblock%}
|
Reference in New Issue
Block a user