mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
feat: improve post, post reply, and chat option
Instead of using separate page for those options, make it use dropdown. Refs: #392
This commit is contained in:
parent
4cc4cb2e7b
commit
23e7d65a31
6 changed files with 153 additions and 195 deletions
|
@ -1,36 +1,15 @@
|
|||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
||||
{% extends 'themes/' + theme() + '/base.html' %}
|
||||
{% else %}
|
||||
{% extends "base.html" %}
|
||||
{% endif %}
|
||||
{% set active_child = 'chats' %}
|
||||
{% from 'bootstrap/form.html' import render_form %}
|
||||
|
||||
{% block app_content %}
|
||||
<div class="row">
|
||||
<div class="col col-login mx-auto">
|
||||
<div class="card mt-5">
|
||||
<div class="card-body p-6">
|
||||
<div class="card-title">{{ _('Options for conversation with "%(member_names)s"', member_names=conversation.member_names(current_user.id)) }}</div>
|
||||
<ul class="option_list">
|
||||
<li><a href="{{ url_for('chat.chat_delete', conversation_id=conversation.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('chat.chat_delete', conversation_id=conversation.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete"></span>
|
||||
{{ _('Delete conversation') }}</a></li>
|
||||
{% for member in conversation.members %}
|
||||
{% for member in conversation.members %}
|
||||
{% if member.id != current_user.id %}
|
||||
<li><a href="{{ url_for('user.block_profile', actor=member.link()) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('user.block_profile', actor=member.link()) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{{ _('Block @%(author_name)s', author_name=member.display_name()) }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for instance in conversation.instances() %}
|
||||
<li><a href="{{ url_for('chat.block_instance', instance_id=instance.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{% endfor %}
|
||||
{% for instance in conversation.instances() %}
|
||||
<li class="dropdown-item"><a href="{{ url_for('chat.block_instance', instance_id=instance.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{{ _("Block chats and posts from instance: %(name)s", name=instance.domain) }}</a></li>
|
||||
{% endfor %}
|
||||
<li><a href="{{ url_for('chat.chat_report', conversation_id=conversation.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-report"></span>
|
||||
{% endfor %}
|
||||
<li class="dropdown-item"><a href="{{ url_for('chat.chat_report', conversation_id=conversation.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-report"></span>
|
||||
{{ _('Report to moderators') }}</a></li>
|
||||
</ul>
|
||||
<p>{{ _('If you are reporting abuse then do not delete the conversation - moderators will not be able to read it if you delete it.') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
<p class="p-2" style="max-width: 200px;">{{ _('If you are reporting abuse then do not delete the conversation - moderators will not be able to read it if you delete it.') }}</p>
|
||||
|
|
|
@ -72,7 +72,23 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
{{ render_form(form) }}
|
||||
<a class="conversation_options btn btn-outline-secondary" href="{{ url_for('chat.chat_options', conversation_id=current_conversation) }}" class="btn btn-outline-secondary">{{ _('Options') }}</a>
|
||||
<div class="dropdown">
|
||||
<a
|
||||
class="conversation_options btn btn-outline-secondary"
|
||||
data-bs-toggle="dropdown" rel="nofollow noindex"
|
||||
href="{{ url_for('chat.chat_options', conversation_id=current_conversation) }}"
|
||||
class="btn btn-outline-secondary">
|
||||
{{ _('Options') }}
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<div
|
||||
hx-get="{{ url_for('chat.chat_options', conversation_id=current_conversation) }}"
|
||||
hx-trigger="revealed"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML"
|
||||
></div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -191,17 +191,7 @@
|
|||
hx-trigger="revealed"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML"
|
||||
hx-select="ul.option_list li"
|
||||
></div>
|
||||
<li>
|
||||
<a class="dropdown-item" href="#">Action</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" href="#">Another action</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" href="#">Something else here</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -95,7 +95,22 @@
|
|||
</div>
|
||||
<div class="comment_actions_link">
|
||||
{% if not post_reply.post.deleted -%}
|
||||
<a href="{{ url_for('post.post_reply_options', post_id=post_reply.post.id, comment_id=post_reply.id) }}" rel="nofollow noindex" aria-label="{{ _('Comment options') }}"><span class="fe fe-options" title="Options"> </span></a>
|
||||
<div class="dropdown">
|
||||
<a
|
||||
href="{{ url_for('post.post_reply_options', post_id=post_reply.post.id, comment_id=post_reply.id) }}"
|
||||
data-bs-toggle="dropdown" rel="nofollow noindex"
|
||||
aria-label="{{ _('Comment options') }}">
|
||||
<span class="fe fe-options" title="Options"> </span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<div
|
||||
hx-get="{{ url_for('post.post_reply_options', post_id=post_reply.post.id, comment_id=post_reply.id) }}"
|
||||
hx-trigger="revealed"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML"
|
||||
></div>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif -%}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,83 +1,62 @@
|
|||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') -%}
|
||||
{% extends 'themes/' + theme() + '/base.html' -%}
|
||||
{% else -%}
|
||||
{% extends "base.html" -%}
|
||||
{% endif -%} -%}
|
||||
{% from 'bootstrap/form.html' import render_form -%}
|
||||
|
||||
{% block app_content -%}
|
||||
<div class="row">
|
||||
<div class="col col-login mx-auto">
|
||||
<div class="card mt-5">
|
||||
<div class="card-body p-6">
|
||||
<div class="card-title">{{ _('Options for "%(post_title)s"', post_title=post.title) }} {% if current_user.is_authenticated -%}{% include 'post/_post_notification_toggle.html' -%}{% endif -%}</div>
|
||||
<ul class="option_list">
|
||||
{% if current_user.is_authenticated -%}
|
||||
{% if current_user.is_authenticated -%}
|
||||
{% if post.user_id == current_user.id -%}
|
||||
<li><a href="{{ url_for('post.post_edit', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-edit"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_edit', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-edit"></span>
|
||||
{{ _('Edit') }}</a></li>
|
||||
{% endif -%}
|
||||
{% if post.user_id == current_user.id or post.community.is_moderator() or post.community.is_owner() or current_user.is_admin() -%}
|
||||
{% if post.deleted -%}
|
||||
<li><a href="{{ url_for('post.post_restore', post_id=post.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-arrow-up"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_restore', post_id=post.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-arrow-up"></span>
|
||||
{{ _('Restore') }}</a></li>
|
||||
<li><a href="{{ url_for('post.post_purge', post_id=post.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete red"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_purge', post_id=post.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete red"></span>
|
||||
{{ _('Purge') }}</a></li>
|
||||
{% else -%}
|
||||
<li><a href="{{ url_for('post.post_delete', post_id=post.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_delete', post_id=post.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete"></span>
|
||||
{{ _('Delete') }}</a></li>
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% if existing_bookmark -%}
|
||||
<li><a href="{{ url_for('post.post_remove_bookmark', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-bookmark"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_remove_bookmark', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-bookmark"></span>
|
||||
{{ _('Remove bookmark') }}</a></li>
|
||||
{% else -%}
|
||||
<li><a href="{{ url_for('post.post_bookmark', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-bookmark"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_bookmark', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-bookmark"></span>
|
||||
{{ _('Bookmark') }}</a></li>
|
||||
{% endif -%}
|
||||
{% if post.user_id == current_user.id and not post.mea_culpa -%}
|
||||
<li><a href="{{ url_for('post.post_mea_culpa', post_id=post.id) }}" class="no-underline"><span class="fe fe-mea-culpa"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_mea_culpa', post_id=post.id) }}" class="no-underline"><span class="fe fe-mea-culpa"></span>
|
||||
{{ _("I made a mistake with this post and have changed my mind about the topic") }}</a></li>
|
||||
{% endif -%}
|
||||
{% if post.user_id != current_user.id -%}
|
||||
{% if post.type == POST_TYPE_LINK and post.author.bot and (post.cross_posts is none or len(post.cross_posts) == 0) -%}
|
||||
<li><a class="no-underline" aria-label="{{ _('Cross-post') }}" href="{{ url_for('post.post_cross_post', post_id=post.id) }}"><span class="fe fe-cross-post"></span>
|
||||
<li class="dropdown-item"><a class="no-underline" aria-label="{{ _('Cross-post') }}" href="{{ url_for('post.post_cross_post', post_id=post.id) }}"><span class="fe fe-cross-post"></span>
|
||||
{{ _('Cross-post to another community') }}</a></li>
|
||||
{% endif -%}
|
||||
<li><a href="{{ url_for('post.post_block_user', post_id=post.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_block_user', post_id=post.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{{ _('Block post author @%(author_name)s', author_name=post.author.user_name) }}</a></li>
|
||||
<li><a href="{{ url_for('post.post_block_community', post_id=post.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_block_community', post_id=post.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{{ _('Block community %(community_name)s', community_name=post.community.display_name()) }}</a></li>
|
||||
{% if post.community.is_moderator() or current_user.is_admin() -%}
|
||||
<li><a href="{{ url_for('community.community_ban_user', community_id=post.community.id, user_id=post.author.id) }}" class="no-underline"><span class="fe fe-block red"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('community.community_ban_user', community_id=post.community.id, user_id=post.author.id) }}" class="no-underline"><span class="fe fe-block red"></span>
|
||||
{{ _('Ban post author @%(author_name)s from %(community_name)s', author_name=post.author.user_name, community_name=post.community.title) }}</a></li>
|
||||
{% endif -%}
|
||||
{% if post.domain_id -%}
|
||||
<li><a href="{{ url_for('post.post_block_domain', post_id=post.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_block_domain', post_id=post.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{{ _('Block domain %(domain)s', domain=post.domain.name) }}</a></li>
|
||||
{% endif -%}
|
||||
{% if post.instance_id and post.instance_id != 1 -%}
|
||||
<li><a href="{{ url_for('post.post_block_instance', post_id=post.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_block_instance', post_id=post.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{{ _("Hide every post from author's instance: %(name)s", name=post.instance.domain) }}</a></li>
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% if post.ap_id -%}
|
||||
<li><a href="{{ post.ap_id }}" rel="nofollow" class="no-underline"><span class="fe fe-external"></span>
|
||||
{% endif -%}
|
||||
{% if post.ap_id -%}
|
||||
<li class="dropdown-item"><a href="{{ post.ap_id }}" rel="nofollow" class="no-underline"><span class="fe fe-external"></span>
|
||||
{{ _('View original on %(domain)s', domain=post.instance.domain) }}</a></li>
|
||||
{% endif -%}
|
||||
<li><a href="{{ url_for('post.post_report', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-report"></span>
|
||||
{% endif -%}
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_report', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-report"></span>
|
||||
{{ _('Report to moderators') }}</a></li>
|
||||
{% if current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff()) -%}
|
||||
<li><a href="{{ url_for('post.post_view_voting_activity', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-sticky-left"></span>
|
||||
{% if current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff()) -%}
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_view_voting_activity', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-sticky-left"></span>
|
||||
{{ _('View Voting Activity') }}</a></li>
|
||||
<li><a href="{{ url_for('post.post_fixup_from_remote', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-sticky-right"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_fixup_from_remote', post_id=post.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-sticky-right"></span>
|
||||
{{ _('Fixup from remote') }}</a></li>
|
||||
{% endif -%}
|
||||
</ul>
|
||||
<p>{{ _('If you want to perform more than one of these (e.g. block and report), hold down Ctrl and click, then complete the operation in the new tabs that open.') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock -%}
|
||||
{% endif -%}
|
||||
|
|
|
@ -1,63 +1,42 @@
|
|||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') -%}
|
||||
{% extends 'themes/' + theme() + '/base.html' -%}
|
||||
{% else -%}
|
||||
{% extends "base.html" -%}
|
||||
{% endif -%} -%}
|
||||
{% from 'bootstrap/form.html' import render_form -%}
|
||||
|
||||
{% block app_content -%}
|
||||
<div class="row">
|
||||
<div class="col col-login mx-auto">
|
||||
<div class="card mt-5">
|
||||
<div class="card-body p-6">
|
||||
<div class="card-title">{{ _('Options for comment on "%(post_title)s"', post_title=post.title) }}</div>
|
||||
<ul class="option_list">
|
||||
{% if current_user.is_authenticated -%}
|
||||
{% if current_user.is_authenticated -%}
|
||||
{% if post_reply.user_id == current_user.id -%}
|
||||
<li><a href="{{ url_for('post.post_reply_edit', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-edit"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_edit', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-edit"></span>
|
||||
{{ _('Edit') }}</a></li>
|
||||
{% endif -%}
|
||||
{% if post_reply.user_id == current_user.id or post.community.is_moderator() or post.community.is_owner() or current_user.is_admin() -%}
|
||||
{% if post_reply.deleted -%}
|
||||
<li><a href="{{ url_for('post.post_reply_restore', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-arrow-up"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_restore', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-arrow-up"></span>
|
||||
{{ _('Restore') }}</a></li>
|
||||
{% if not post_reply.has_replies() -%}
|
||||
{% if post.community.is_moderator() or current_user.is_admin() or (post_reply.user_id == current_user.id and post_reply.deleted_by == post_reply.user_id) -%}
|
||||
<li><a href="{{ url_for('post.post_reply_purge', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete red"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_purge', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete red"></span>
|
||||
{{ _('Purge') }}</a></li>
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% else -%}
|
||||
<li><a href="{{ url_for('post.post_reply_delete', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_delete', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline confirm_first" rel="nofollow"><span class="fe fe-delete"></span>
|
||||
{{ _('Delete') }}</a></li>
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% if existing_bookmark -%}
|
||||
<li><a href="{{ url_for('post.post_reply_remove_bookmark', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-bookmark"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_remove_bookmark', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-bookmark"></span>
|
||||
{{ _('Remove bookmark') }}</a></li>
|
||||
{% else -%}
|
||||
<li><a href="{{ url_for('post.post_reply_bookmark', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-bookmark"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_bookmark', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-bookmark"></span>
|
||||
{{ _('Bookmark') }}</a></li>
|
||||
{% endif -%}
|
||||
{% if post_reply.user_id != current_user.id -%}
|
||||
<li><a href="{{ url_for('post.post_reply_block_user', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_block_user', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{{ _('Block author @%(author_name)s', author_name=post_reply.author.user_name) }}</a></li>
|
||||
{% if post_reply.instance_id and post_reply.instance_id != 1 -%}
|
||||
<li><a href="{{ url_for('post.post_reply_block_instance', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_block_instance', post_id=post.id, comment_id=post_reply.id) }}" class="no-underline"><span class="fe fe-block"></span>
|
||||
{{ _("Hide every post from author's instance: %(name)s", name=post_reply.instance.domain) }}</a></li>
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% if current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff()) -%}
|
||||
<li><a href="{{ url_for('post.post_reply_view_voting_activity', comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-sticky-left"></span>
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_view_voting_activity', comment_id=post_reply.id) }}" class="no-underline" rel="nofollow"><span class="fe fe-sticky-left"></span>
|
||||
{{ _('View Voting Activity') }}</a></li>
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
<li><a href="{{ url_for('post.post_reply_report', post_id=post.id, comment_id=post_reply.id) }}" rel="nofollow" class="no-underline"><span class="fe fe-report"></span>
|
||||
{% endif -%}
|
||||
<li class="dropdown-item"><a href="{{ url_for('post.post_reply_report', post_id=post.id, comment_id=post_reply.id) }}" rel="nofollow" class="no-underline"><span class="fe fe-report"></span>
|
||||
{{ _('Report to moderators') }}</a></li>
|
||||
</ul>
|
||||
<p>{{ _('If you want to perform more than one of these (e.g. block and report), hold down Ctrl and click, then complete the operation in the new tabs that open.') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock -%}
|
||||
|
|
Loading…
Reference in a new issue