From 23e7d65a312dcf2e9842d9c724105ca88fdb776a Mon Sep 17 00:00:00 2001 From: hono4kami Date: Fri, 20 Dec 2024 00:44:49 +0700 Subject: [PATCH] feat: improve post, post reply, and chat option Instead of using separate page for those options, make it use dropdown. Refs: #392 --- app/templates/chat/chat_options.html | 51 +++----- app/templates/chat/conversation.html | 20 ++- app/templates/post/_post_full.html | 10 -- app/templates/post/_post_reply_teaser.html | 17 ++- app/templates/post/post_options.html | 145 +++++++++------------ app/templates/post/post_reply_options.html | 105 ++++++--------- 6 files changed, 153 insertions(+), 195 deletions(-) diff --git a/app/templates/chat/chat_options.html b/app/templates/chat/chat_options.html index 211673c1..5e0e8c33 100644 --- a/app/templates/chat/chat_options.html +++ b/app/templates/chat/chat_options.html @@ -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 %} -
- -
-{% endblock %} \ No newline at end of file + +{% for member in conversation.members %} + {% if member.id != current_user.id %} + + {% endif %} +{% endfor %} +{% for instance in conversation.instances() %} + +{% endfor %} + +

{{ _('If you are reporting abuse then do not delete the conversation - moderators will not be able to read it if you delete it.') }}

diff --git a/app/templates/chat/conversation.html b/app/templates/chat/conversation.html index 62aa8e09..f13f59c4 100644 --- a/app/templates/chat/conversation.html +++ b/app/templates/chat/conversation.html @@ -72,7 +72,23 @@ {% endfor %} {{ render_form(form) }} - {{ _('Options') }} + {% endif %} @@ -80,4 +96,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/templates/post/_post_full.html b/app/templates/post/_post_full.html index acf688e1..4618ebb1 100644 --- a/app/templates/post/_post_full.html +++ b/app/templates/post/_post_full.html @@ -191,17 +191,7 @@ hx-trigger="revealed" hx-target="this" hx-swap="outerHTML" - hx-select="ul.option_list li" > -
  • - Action -
  • -
  • - Another action -
  • -
  • - Something else here -
  • diff --git a/app/templates/post/_post_reply_teaser.html b/app/templates/post/_post_reply_teaser.html index 1f57ea73..59594cc7 100644 --- a/app/templates/post/_post_reply_teaser.html +++ b/app/templates/post/_post_reply_teaser.html @@ -95,7 +95,22 @@ diff --git a/app/templates/post/post_options.html b/app/templates/post/post_options.html index 5f358e64..a3edfa81 100644 --- a/app/templates/post/post_options.html +++ b/app/templates/post/post_options.html @@ -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 -%} -
    - -
    -{% endblock -%} +{% if current_user.is_authenticated -%} + {% if post.user_id == current_user.id -%} + + {% 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 -%} + + + {% else -%} + + {% endif -%} + {% endif -%} + {% if existing_bookmark -%} + + {% else -%} + + {% endif -%} + {% if post.user_id == current_user.id and not post.mea_culpa -%} + + {% 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) -%} + + {% endif -%} + + + {% if post.community.is_moderator() or current_user.is_admin() -%} + + {% endif -%} + {% if post.domain_id -%} + + {% endif -%} + {% if post.instance_id and post.instance_id != 1 -%} + + {% endif -%} + {% endif -%} +{% endif -%} +{% if post.ap_id -%} + +{% endif -%} + +{% if current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff()) -%} + + +{% endif -%} diff --git a/app/templates/post/post_reply_options.html b/app/templates/post/post_reply_options.html index 339deb57..e591e1cf 100644 --- a/app/templates/post/post_reply_options.html +++ b/app/templates/post/post_reply_options.html @@ -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 -%} -
    - -
    -{% endblock -%} +{% if current_user.is_authenticated -%} + {% if post_reply.user_id == current_user.id -%} + + {% 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 -%} + + {% 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) -%} + + {% endif -%} + {% endif -%} + {% else -%} + + {% endif -%} + {% endif -%} + {% if existing_bookmark -%} + + {% else -%} + + {% endif -%} + {% if post_reply.user_id != current_user.id -%} + + {% if post_reply.instance_id and post_reply.instance_id != 1 -%} + + {% endif -%} + {% endif -%} + {% if current_user.is_authenticated and (current_user.is_admin() or current_user.is_staff()) -%} + + {% endif -%} +{% endif -%} +