From b77a64ccf70c122c6432644243d7f2a989e4ea8f Mon Sep 17 00:00:00 2001 From: hono4kami Date: Thu, 19 Dec 2024 21:02:02 +0700 Subject: [PATCH 1/3] feat: WIP better post options Refs: #392 --- app/templates/post/_post_full.html | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/templates/post/_post_full.html b/app/templates/post/_post_full.html index 9ae42048..acf688e1 100644 --- a/app/templates/post/_post_full.html +++ b/app/templates/post/_post_full.html @@ -181,7 +181,29 @@ {% endif -%}
- +
From 23e7d65a312dcf2e9842d9c724105ca88fdb776a Mon Sep 17 00:00:00 2001 From: hono4kami Date: Fri, 20 Dec 2024 00:44:49 +0700 Subject: [PATCH 2/3] 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 -%} + From 5ce0653292c00fd7b173efc8b0bebf03bb72d1e9 Mon Sep 17 00:00:00 2001 From: hono4kami Date: Sat, 21 Dec 2024 22:04:13 +0700 Subject: [PATCH 3/3] feat: improve options --- app/templates/chat/chat_options.html | 8 ++--- app/templates/chat/conversation.html | 2 +- app/templates/post/_post_full.html | 2 +- app/templates/post/_post_reply_teaser.html | 2 +- app/templates/post/post_options.html | 34 +++++++++---------- app/templates/post/post_reply_options.html | 20 +++++------ .../post/post_teaser/_utilities_bar.html | 16 +++++++-- 7 files changed, 48 insertions(+), 36 deletions(-) diff --git a/app/templates/chat/chat_options.html b/app/templates/chat/chat_options.html index 5e0e8c33..ab773be7 100644 --- a/app/templates/chat/chat_options.html +++ b/app/templates/chat/chat_options.html @@ -1,15 +1,15 @@ -
  • {{ _('Delete conversation') }}
  • {% for member in conversation.members %} {% if member.id != current_user.id %} -
  • {{ _('Block @%(author_name)s', author_name=member.display_name()) }}
  • {% endif %} {% endfor %} {% for instance in conversation.instances() %} -
  • {{ _("Block chats and posts from instance: %(name)s", name=instance.domain) }}
  • {% endfor %} -
  • {{ _('Report to moderators') }}
  • {{ _('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 f13f59c4..2e4337a0 100644 --- a/app/templates/chat/conversation.html +++ b/app/templates/chat/conversation.html @@ -80,7 +80,7 @@ class="btn btn-outline-secondary"> {{ _('Options') }} -