123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- {% extends "misago/thread/replies.html" %}
- {% load i18n %}
- {% block page-details %}
- {{ block.super }}
- <li>
- <button type="button" class="btn-show-participants" data-participants-url="{% url 'misago:private_thread_participants' thread_slug=thread.slug thread_id=thread.id %}">
- <span class="fa fa-users"></span> <span class="participants-message">{% blocktrans trimmed count users=thread.participants_list|length %}
- {{ users }} participant
- {% plural %}
- {{ users }} participants
- {% endblocktrans %}</span>
- </button>
- <li>
- {% endblock page-details %}
- {% block thread-actions %}
- {{ block.super }}
- {% if 'participants' in thread_actions %}
- <button class="btn action-participants btn-default pull-right" type="button">
- <span class="fa fa-users"></span>
- {% trans "Edit participants" %}
- </button>
- {% endif %}
- {% endblock thread-actions %}
- {% block post-actions %}
- {{ block.super }}
- {% if thread.participant %}
- <form action="{% url 'misago:private_thread_leave' thread_slug=thread.slug thread_id=thread.id %}" method="POST" class="leave-thread-form pull-right">
- {% csrf_token %}
- <button class="btn btn-default" type="submit">
- <span class="fa fa-sign-out"></span>
- {% trans "Leave thread" %}
- </button>
- </form>
- {% endif %}
- {% endblock post-actions %}
- {% block javascripts %}
- {{ block.super }}
- <script lang="JavaScript">
- var lang_give_ownership = "{% trans "Are you sure you want to pass thread ownership to this user?" %}";
- $(function() {
- var participants_cache = {};
- function enable_participants_popover($e, data) {
- $e.popover({
- html: true,
- content: data,
- placement: 'bottom',
- trigger: 'focus',
- template: '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>'
- });
- }
- $('.btn-show-participants').click(function() {
- var $btn = $(this);
- var api_url = $btn.data('participants-url');
- if (participants_cache[api_url] == undefined) {
- $.get(api_url, function(data) {
- participants_cache[api_url] = data;
- enable_participants_popover($btn, participants_cache[api_url]);
- $btn.popover('show');
- })
- }
- });
- {% if thread.participant %}
- $('.leave-thread-form').submit(function() {
- {% if thread.participants_list|length == 1 %}
- var prompt = confirm("{% trans "Are you sure you want to leave this thread? It will be deleted after you leave it." %}");
- {% else %}
- var prompt = confirm("{% trans "Are you sure you want to leave this thread?" %}");
- {% endif %}
- return prompt
- });
- {% endif %}
- {% if 'participants' in thread_actions %}
- var lang_give_ownership = "{% trans "Are you sure you want to give thread ownership to this user?" %}";
- $('.action-participants').click(function() {
- Misago.ParticipantsEditor.open({
- api_url: '{% url "misago:private_thread_edit_participants" thread_id=thread.id thread_slug=thread.slug %}'
- })
- });
- {% endif %}
- });
- </script>
- {% endblock %}
|