From 7d685c5e64149e20c7dc8977f645e050be53ddfd Mon Sep 17 00:00:00 2001 From: Jonas Kohl Date: Tue, 10 Dec 2024 17:15:10 +0100 Subject: Add classic theme --- src/application/templates/old/components/post.twig | 169 +++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 src/application/templates/old/components/post.twig (limited to 'src/application/templates/old/components/post.twig') diff --git a/src/application/templates/old/components/post.twig b/src/application/templates/old/components/post.twig new file mode 100644 index 0000000..6b04bca --- /dev/null +++ b/src/application/templates/old/components/post.twig @@ -0,0 +1,169 @@ +{%- set fileAttachments = attachments|filter(a => not (a.mimeType starts with "image/" or a.mimeType starts with "video/")) -%} +{%- set imageAttachments = attachments|filter(a => a.mimeType starts with "image/" or a.mimeType starts with "video/") -%} + +{%- set canReply = + not post.deleted + and not topic.isLocked + and currentUser is not null + and currentUser.hasPermission(permission("CREATE_OWN_POST")) +-%} + +{%- set canEdit = + not post.deleted + and not topic.isLocked + and currentUser is not null + and ( + ( + postAuthor is not null + and postAuthor.id == currentUser.id + and postAuthor.hasPermission(permission("EDIT_OWN_POST")) + ) + or currentUser.hasPermission(permission("EDIT_OTHER_POST")) + ) -%} + +{%- set canDelete = + not post.deleted + and currentUser is not null + and ( + ( + postAuthor is not null + and postAuthor.id == currentUser.id + and postAuthor.hasPermission(permission("DELETE_OWN_POST")) + ) + or currentUser.hasPermission(permission("DELETE_OTHER_POST")) + ) -%} + +{%- set canViewAttachments = currentUser is not null -%} + +{%- set your_are_the_author = + currentUser is not null + and postAuthor is not null + and currentUser.id == postAuthor.id +-%} + +{%- set is_op = + topicAuthor is not null + and postAuthor is not null + and postAuthor.id == topicAuthor.id +-%} + +{%- set hasOtherAttachments = (fileAttachments|length > 0) -%} + +{% if post.deleted %} + + + + + + +
+  {# + #}{{ __("This post has been deleted") }} +
+ + +{% else %} + + + {% if not hide_pfp %} + {% if postAuthor %} + {% if hide_actions %} + {{ __( + {% else %} + + {{ __( + + {% endif %} + {% else %} +
+ {% endif %} + {% endif %} + + + + {% if not hide_actions %} +
{# + #}{{ __( + {%- if canReply -%} + + {%- endif -%} + {%- if canEdit -%} +
{# + #}{# + #}{# + #}
+ {%- endif -%} + {%- if canDelete -%} +
{# + #}{# + #}{# + #}
+ {%- endif -%} +
+ {% endif %} + {% if postAuthor %} + {% if hide_actions %} + {{ postAuthor.displayName }} + {% else %} + {{ postAuthor.displayName }} + {% endif %} + {% if your_are_the_author %} + [{{ __("You") }}] + {% endif %} + {% if is_op %} + {{ __( + {% endif %} + {% else %} + {{ __("(deleted)") }} + {% endif %} +
+ {{ post.postDate.format("c") }} + {% if post.edited %} + {{ __("(edited)") }} + {% endif %} + + + + + {{ renderPost(post.content) }} + {% if imageAttachments|length > 0 %} +
+ {% for attachment in imageAttachments %} + {% if hide_actions %} + + + + {% else %} + + + {% if canViewAttachments %} + + {% else %} + + {% endif %} + + {% endif %} + {% endfor %} +
+ {% endif %} + + + {% if hasOtherAttachments %} + + + {% for attachment in fileAttachments %} + {% if hide_actions %} + {{ attachment.name }} + {% else %} + + {% if not canViewAttachments %} + + {% endif %} + {{ attachment.name }} + + {% endif %} + {% endfor %} + + + {% endif %} +{% endif %} -- cgit v1.2.3