Move to src dir.
[edumed.git] / src / forum / templates / pybb / topic.html
diff --git a/src/forum/templates/pybb/topic.html b/src/forum/templates/pybb/topic.html
new file mode 100644 (file)
index 0000000..f11f2cb
--- /dev/null
@@ -0,0 +1,102 @@
+{% extends 'pybb/base.html' %}
+
+{% load url from future %}
+
+{% load pybb_tags i18n %}
+
+{% block title %}{{ topic }}{% endblock %}
+
+{% block extra_script %}
+    {{ block.super }}
+    {% include "pybb/_markitup.html" %}
+    <script type="text/javascript" src="{{ STATIC_URL }}pybb/js/jquery.formset.min.js"></script>
+{% endblock %}
+
+{% block breadcrumb %}
+    {% with object=topic %}
+        {% include "pybb/breadcrumb.html" %}
+    {% endwith %}
+{% endblock %}
+
+{% block content %}
+    <div class="topic">
+        <h1>{{ topic.name }}</h1>
+        
+        {% include 'forum/related_lesson_info.html' with lesson=topic.edumed_topic.lesson %}
+        
+        {% with _('Posts') as label %}
+            {% include "pybb/pagination.html" %}
+        {% endwith %}
+
+        {% if topic.poll_type %}
+            {% include 'pybb/poll.html' %}
+        {% endif %}
+
+        <div class="posts">
+            {% if first_post %}{% ifnotequal first_post post_list.0 %}
+                {% with first_post as post %}
+                    <li class="first_post">{% include "pybb/post_template.html" %}</li>
+                {% endwith %}
+            {% endifnotequal %}{% endif %}
+            {% for post in post_list %}
+                {% cycle 'odd' 'even' as rowcolors silent %}
+                {% include "pybb/post_template.html" %}
+            {% endfor %}
+        </div>
+        <div>&nbsp;</div>
+        {% with _('Posts') as label %}
+            {% include "pybb/pagination.html" %}
+        {% endwith %}
+
+        {% if user.is_authenticated %}
+            <div class="controls">
+                {% if user.is_moderator %}
+                    {% if topic.sticky %}
+                        <a href="{% url 'pybb:unstick_topic' topic.id %}">{% trans "Unstick topic" %}</a> /
+                    {% else %}
+                        <a href="{% url 'pybb:stick_topic' topic.id %}">{% trans "Stick topic" %}</a> /
+                    {% endif %}
+
+                    {% if topic.closed %}
+                        <a href="{% url 'pybb:open_topic' topic.id %}">{% trans "Open topic" %}</a> /
+                    {% else %}
+                        <a href="{% url 'pybb:close_topic' topic.id %}">{% trans "Close topic" %}</a> /
+                    {% endif %}
+                    {% if perms.pybb.change_topic and user.is_staff %}
+                        <a href="{% url 'admin:pybb_topic_change' topic.id %}">{% trans 'Admin' %}</a> /
+                    {% endif %}
+                    {% comment %}
+            <a href="{% url 'pybb:merge_topics' %}?topic={{ topic.id }}">{% trans 'Merge topics' %}</a> /
+            {% endcomment %}
+                {% endif %}
+
+                {% if user.is_subscribed %}
+                    <a href="{% url 'pybb:delete_subscription' topic.id %}?from_topic">{% trans "Unsubscribe" %}</a>
+                {% else %}
+                    <a href="{% url 'pybb:add_subscription' topic.id %}">{% trans "Subscribe" %}</a>
+                {% endif %}
+            </div>
+        {% endif %}
+
+        {% if user.is_authenticated or PYBB_ENABLE_ANONYMOUS_POST %}
+            {% pybb_get_profile user=user as user_profile %}
+
+            {% if not user_profile.is_banned %}
+                {% if not topic.closed %}
+                    {% include "pybb/post_form.html" %}
+                {% endif %}
+            {% endif %}
+        {% else %}
+            {% include 'pybb/_need_to_login_message.html' %}
+        {% endif %}
+
+        {% if user.is_staff %}
+            <div class="subscriber-list">
+                {% trans "Subscribers" %}:
+                {% for subscriber in topic.subscribers.all %}
+                    <a href="{% url 'pybb:user' subscriber.username %}">{{ subscriber.username }}</a>,
+                {% endfor %}
+            </div>
+        {% endif %}
+    </div>
+{% endblock %}