Merge branch 'forum'
[edumed.git] / forum / templates / pybb / topic.html
1 {% extends 'pybb/base.html' %}
2
3 {% load url from future %}
4
5 {% load pybb_tags i18n %}
6
7 {% block title %}{{ topic }}{% endblock %}
8
9 {% block extra_script %}
10     {{ block.super }}
11     {% include "pybb/_markitup.html" %}
12     <script type="text/javascript" src="{{ STATIC_URL }}pybb/js/jquery.formset.min.js"></script>
13 {% endblock %}
14
15 {% block breadcrumb %}
16     {% with object=topic %}
17         {% include "pybb/breadcrumb.html" %}
18     {% endwith %}
19 {% endblock %}
20
21 {% block content %}
22     <div class="topic">
23         <h1>{{ topic.name }}</h1>
24         
25         {% include 'forum/related_lesson_info.html' with lesson=topic.edumed_topic.lesson %}
26         
27         {% with _('Posts') as label %}
28             {% include "pybb/pagination.html" %}
29         {% endwith %}
30
31         {% if topic.poll_type %}
32             {% include 'pybb/poll.html' %}
33         {% endif %}
34
35         <div class="posts">
36             {% if first_post %}{% ifnotequal first_post post_list.0 %}
37                 {% with first_post as post %}
38                     <li class="first_post">{% include "pybb/post_template.html" %}</li>
39                 {% endwith %}
40             {% endifnotequal %}{% endif %}
41             {% for post in post_list %}
42                 {% cycle 'odd' 'even' as rowcolors silent %}
43                 {% include "pybb/post_template.html" %}
44             {% endfor %}
45         </div>
46         <div>&nbsp;</div>
47         {% with _('Posts') as label %}
48             {% include "pybb/pagination.html" %}
49         {% endwith %}
50
51         {% if user.is_authenticated %}
52             <div class="controls">
53                 {% if user.is_moderator %}
54                     {% if topic.sticky %}
55                         <a href="{% url 'pybb:unstick_topic' topic.id %}">{% trans "Unstick topic" %}</a> /
56                     {% else %}
57                         <a href="{% url 'pybb:stick_topic' topic.id %}">{% trans "Stick topic" %}</a> /
58                     {% endif %}
59
60                     {% if topic.closed %}
61                         <a href="{% url 'pybb:open_topic' topic.id %}">{% trans "Open topic" %}</a> /
62                     {% else %}
63                         <a href="{% url 'pybb:close_topic' topic.id %}">{% trans "Close topic" %}</a> /
64                     {% endif %}
65                     {% if perms.pybb.change_topic and user.is_staff %}
66                         <a href="{% url 'admin:pybb_topic_change' topic.id %}">{% trans 'Admin' %}</a> /
67                     {% endif %}
68                     {% comment %}
69             <a href="{% url 'pybb:merge_topics' %}?topic={{ topic.id }}">{% trans 'Merge topics' %}</a> /
70             {% endcomment %}
71                 {% endif %}
72
73                 {% if user.is_subscribed %}
74                     <a href="{% url 'pybb:delete_subscription' topic.id %}?from_topic">{% trans "Unsubscribe" %}</a>
75                 {% else %}
76                     <a href="{% url 'pybb:add_subscription' topic.id %}">{% trans "Subscribe" %}</a>
77                 {% endif %}
78             </div>
79         {% endif %}
80
81         {% if user.is_authenticated or PYBB_ENABLE_ANONYMOUS_POST %}
82             {% pybb_get_profile user=user as user_profile %}
83
84             {% if not user_profile.is_banned %}
85                 {% if not topic.closed %}
86                     {% include "pybb/post_form.html" %}
87                 {% endif %}
88             {% endif %}
89         {% else %}
90             {% include 'pybb/_need_to_login_message.html' %}
91         {% endif %}
92
93         {% if user.is_staff %}
94             <div class="subscriber-list">
95                 {% trans "Subscribers" %}:
96                 {% for subscriber in topic.subscribers.all %}
97                     <a href="{% url 'pybb:user' subscriber.username %}">{{ subscriber.username }}</a>,
98                 {% endfor %}
99             </div>
100         {% endif %}
101     </div>
102 {% endblock %}