🎨 topic actions

This commit is contained in:
Greg Newman
2022-12-15 15:33:07 -05:00
parent ab7d2f0213
commit e5c790596f
2 changed files with 54 additions and 24 deletions

View File

@@ -12,31 +12,61 @@
{% get_permission 'can_update_topics_to_announces' topic.forum request.user as user_can_change_to_announces %}
{% if user_can_add_post %}
<a href="{% url 'forum_conversation:post_create' forum.slug forum.pk topic.slug topic.pk %}" class="rounded rounded-lg border border-1 border-orange text-orange uppercase text-sm py-2 px-4 mr-3"><img class="inline-block mr-3" src="{% static 'img/icons/icon_button-talk-bubble.svg' %}" />{% trans "Post reply" %}</a>
<a href="{% url 'forum_conversation:post_create' forum.slug forum.pk topic.slug topic.pk %}"
class="rounded rounded-lg border border-1 border-orange text-orange uppercase text-sm py-3 px-4"><img
class="inline-block" src="{% static 'img/icons/icon_button-talk-bubble.svg' %}"/>{% trans "Post reply" %}</a>
{% endif %}
{% if user_can_subscribe_to_topic %}
<a href="{% url 'forum_member:topic_subscribe' topic.pk %}" class="rounded rounded-lg border border-1 border-slate text-orange uppercase text-sm py-2 px-4"><img class="inline-block mr-3" src="{% static 'img/icons/icon_button-checkmark.svg' %}" />{% trans "Subscribe" %}</a>
<a href="{% url 'forum_member:topic_subscribe' topic.pk %}"
class="rounded rounded-lg border border-1 border-slate text-orange uppercase text-sm py-3 px-4"><img
class="inline-block" src="{% static 'img/icons/icon_button-checkmark.svg' %}"/>{% trans "Subscribe" %}</a>
{% elif user_can_unsubscribe_from_topic %}
<a href="{% url 'forum_member:topic_unsubscribe' topic.pk %}" class="btn btn-info btn-sm btn-subscription"><i class="fas fa-times">&nbsp;</i>{% trans "Unsubscribe" %}</a>
<a href="{% url 'forum_member:topic_unsubscribe' topic.pk %}" class="btn btn-info btn-sm btn-subscription"><i
class="fas fa-times">&nbsp;</i>{% trans "Unsubscribe" %}</a>
{% endif %}
{% if user_can_lock_topics and not topic.is_locked or user_can_move_topics or user_can_delete_topics %}
<div class="btn-group moderation-dropdown">
<button id="id_dropdown_moderation_menu_button" class="btn btn-warning btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-gavel">&nbsp;&nbsp;</i><span class="caret"></span></button>
<div class="dropdown-menu" aria-labelledby="id_dropdown_moderation_menu_button" style="min-width:13rem;">
{% if user_can_lock_topics and not topic.is_locked %}<a href="{% url 'forum_moderation:topic_lock' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Lock topic" %}</a>{% endif %}
{% if user_can_lock_topics and topic.is_locked %}<a href="{% url 'forum_moderation:topic_unlock' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Unlock topic" %}</a>{% endif %}
{% if user_can_delete_topics %}<a href="{% url 'forum_moderation:topic_delete' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Delete topic" %}</a>{% endif %}
{% if user_can_move_topics %}<a href="{% url 'forum_moderation:topic_move' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Move topic" %}</a>{% endif %}
{% if topic.is_topic %}
{% if user_can_change_to_sticky_topics %}<a href="{% url 'forum_moderation:topic_update_to_sticky' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Change to sticky topic" %}</a>{% endif %}
{% if user_can_change_to_announces %}<a href="{% url 'forum_moderation:topic_update_to_announce' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Change to announce" %}</a>{% endif %}
{% elif topic.is_sticky %}
{% if user_can_change_to_normal_topics %}<a href="{% url 'forum_moderation:topic_update_to_post' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Change to standard topic" %}</a>{% endif %}
{% if user_can_change_to_announces %}<a href="{% url 'forum_moderation:topic_update_to_announce' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Change to announce" %}</a>{% endif %}
{% elif topic.is_announce %}
{% if user_can_change_to_normal_topics %}<a href="{% url 'forum_moderation:topic_update_to_post' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Change to standard topic" %}</a>{% endif %}
{% if user_can_change_to_sticky_topics %}<a href="{% url 'forum_moderation:topic_update_to_sticky' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Change to sticky topic" %}</a>{% endif %}
{% endif %}
<div class="inline-block">
<button id="id_dropdown_moderation_menu_button" class="rounded rounded-lg border border-1 border-slate text-orange py-3 px-4" type="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img src="{% static 'img/icons/icon_button-gavel.svg' %}" />
</button>
{# TODO: This is hidden but needs to be displayed with x-show #}
<div class="dropdown-menu hidden" aria-labelledby="id_dropdown_moderation_menu_button" style="min-width:13rem;">
{% if user_can_lock_topics and not topic.is_locked %}
<a href="{% url 'forum_moderation:topic_lock' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Lock topic" %}</a>{% endif %}
{% if user_can_lock_topics and topic.is_locked %}
<a href="{% url 'forum_moderation:topic_unlock' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Unlock topic" %}</a>{% endif %}
{% if user_can_delete_topics %}<a href="{% url 'forum_moderation:topic_delete' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Delete topic" %}</a>{% endif %}
{% if user_can_move_topics %}<a href="{% url 'forum_moderation:topic_move' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Move topic" %}</a>{% endif %}
{% if topic.is_topic %}
{% if user_can_change_to_sticky_topics %}
<a href="{% url 'forum_moderation:topic_update_to_sticky' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Change to sticky topic" %}</a>{% endif %}
{% if user_can_change_to_announces %}
<a href="{% url 'forum_moderation:topic_update_to_announce' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Change to announce" %}</a>{% endif %}
{% elif topic.is_sticky %}
{% if user_can_change_to_normal_topics %}
<a href="{% url 'forum_moderation:topic_update_to_post' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Change to standard topic" %}</a>{% endif %}
{% if user_can_change_to_announces %}
<a href="{% url 'forum_moderation:topic_update_to_announce' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Change to announce" %}</a>{% endif %}
{% elif topic.is_announce %}
{% if user_can_change_to_normal_topics %}
<a href="{% url 'forum_moderation:topic_update_to_post' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Change to standard topic" %}</a>{% endif %}
{% if user_can_change_to_sticky_topics %}
<a href="{% url 'forum_moderation:topic_update_to_sticky' slug=topic.slug pk=topic.pk %}"
class="dropdown-item">{% trans "Change to sticky topic" %}</a>{% endif %}
{% endif %}
</div>
</div>
</div>
{% endif %}

View File

@@ -9,7 +9,7 @@
{% block content %}
<div class="w-full mb-8"><h1>{{ topic.subject }}</h1></div>
<div class="w-full">
<div class="topic-actions-block">
<div class="items-center inline-flex space-x-3">
{% include "forum_conversation/partials/topic_detail_actions.html" %}
</div>
<div class="pagination-block">
@@ -91,7 +91,7 @@
{% include "partials/avatar.html" with profile=post.poster.forum_profile show_placeholder=True %}
</a>
</div>
<div class="username"><a href="{% url 'forum_member:profile' post.poster_id %}"><b>{{ post.poster|forum_member_display_name }}</b></a></div>
<div class="username"><a class="text-orange" href="{% url 'forum_member:profile' post.poster_id %}"><b>{{ post.poster|forum_member_display_name }}</b></a></div>
<div class="posts-count text-muted"><b>{% trans "Posts:" %}</b>&nbsp;{{ post.poster.forum_profile.posts_count }}</div>
{% else %}
<div class="username"><b>{{ post.username }}</b></div>
@@ -105,7 +105,7 @@
</div>
</div>
<div class="w-full mt-11">
<div class="w-1/2 topic-actions-block">
<div class="w-1/2 items-center inline-flex space-x-3">
{% include "forum_conversation/partials/topic_detail_actions.html" %}
</div>
<div class="w-full">