diff options
author | Jonas Kohl | 2024-12-10 17:15:10 +0100 |
---|---|---|
committer | Jonas Kohl | 2024-12-10 17:15:10 +0100 |
commit | 7d685c5e64149e20c7dc8977f645e050be53ddfd (patch) | |
tree | 44a931c23979aaa2e22b079f8af9232f490eb4d3 /src/application/templates/old/components/post.twig | |
parent | 7c9f91333da983da37d3dc837fa61ef0bff64549 (diff) |
Add classic theme
Diffstat (limited to 'src/application/templates/old/components/post.twig')
-rw-r--r-- | src/application/templates/old/components/post.twig | 169 |
1 files changed, 169 insertions, 0 deletions
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 %} + <tr> + <td width="64"></td> + <td> + <a id="post-{{ post.id }}"></a> + <table cellspacing="0" cellpadding="4" bgcolor="pink" border="1" bordercolor="red"> + <tr><td> + <img src="/ui/theme-files/old/delete.gif" border="0" alt="" width="16" height="16" draggable="false" class="inline-icon"> {# + #}{{ __("This post has been deleted") }} + </td></tr> + </table> + </td> + </tr> +{% else %} + <tr> + <td width="64" rowspan="{{ hasOtherAttachments ? "3" : "2" }}" valign="top"> + {% if not hide_pfp %} + {% if postAuthor %} + {% if hide_actions %} + <img class="media-object" alt="{{ __("Profile picture") }}" src="?_action=profilepicture&user={{ postAuthor.id|url_encode }}" width="64" height="64"> + {% else %} + <a href="?_action=viewuser&user={{ postAuthor.id|url_encode }}"> + <img border="0" class="media-object" alt="{{ __("Profile picture") }}" src="?_action=profilepicture&user={{ postAuthor.id|url_encode }}" width="64" height="64"> + </a> + {% endif %} + {% else %} + <div class="media-object" style="width:64px;height:64px"></div> + {% endif %} + {% endif %} + </td> + <th align="left" height="1" class="no-bold"> + <a id="post-{{ post.id }}" data-text="{{ post.content }}"></a> + {% if not hide_actions %} + <div class="pull-right">{# + #}<a href="#post-{{ post.id }}" class="seamless m-r"><img class="inline-icon" src="/ui/theme-files/old/link.gif" alt="{{ __("Permalink") }}" width="16" height="16" border="0" draggable="false"></a> + {%- if canReply -%} + <button data-post-id="{{ post.id }}" class="seamless m-r js-only _reply-post"><img class="inline-icon" src="/ui/theme-files/old/message.gif" alt="{{ __("Reply to post") }}" width="16" height="16" border="0" draggable="false"></button> + {%- endif -%} + {%- if canEdit -%} + <form action="?_action=editpost" method="post" class="inline">{# + #}<input type="hidden" name="post" value="{{ post.id }}">{# + #}<button type="submit" class="seamless m-r"><img class="inline-icon" src="/ui/theme-files/old/message_edit.gif" alt="{{ __("Edit post") }}" width="16" height="16" border="0" draggable="false"></button>{# + #}</form> + {%- endif -%} + {%- if canDelete -%} + <form action="?_action=deletepost" method="post" class="inline">{# + #}<input type="hidden" name="post" value="{{ post.id }}">{# + #}<button type="submit" class="seamless m-r"><img class="inline-icon" src="/ui/theme-files/old/message_delete.gif" alt="{{ __("Delete post") }}" width="16" height="16" border="0" draggable="false"></button>{# + #}</form> + {%- endif -%} + </div> + {% endif %} + {% if postAuthor %} + {% if hide_actions %} + <b>{{ postAuthor.displayName }}</b> + {% else %} + <a href="?_action=viewuser&user={{ postAuthor.id|url_encode }}"><b>{{ postAuthor.displayName }}</b></a> + {% endif %} + {% if your_are_the_author %} + <font color="red"><small>[{{ __("You") }}]</small></font> + {% endif %} + {% if is_op %} + <img alt="{{ __("Created this topic") }}" title="{{ __("Created this topic") }}" class="m-l inline-icon" width="16" height="16" draggable="false" src="/ui/theme-files/old/microphone.gif"> + {% endif %} + {% else %} + <font color="gray"><i>{{ __("(deleted)") }}</i></font> + {% endif %} + <br> + <span class="_time">{{ post.postDate.format("c") }}</span> + {% if post.edited %} + <font color="gray"><i>{{ __("(edited)") }}</i></font> + {% endif %} + </th> + </tr> + <tr> + <td> + {{ renderPost(post.content) }} + {% if imageAttachments|length > 0 %} + <div class="post-images clearfix"> + {% for attachment in imageAttachments %} + {% if hide_actions %} + <span class="image-attachment" title="{{ attachment.name }}"> + <img border="0" class="image-attachment-image" src="?_action=thumb&attachment={{ attachment.id|url_encode }}" alt="" width="100"> + </span> + {% else %} + <a class="image-attachment attachment" href="?_action=attachment&attachment={{ attachment.id|url_encode }}" title="{{ attachment.name }}"> + <img border="0" class="image-attachment-image" src="?_action=thumb&attachment={{ attachment.id|url_encode }}" alt="" width="100"> + {% if canViewAttachments %} + <img alt="" border="0" class="attachment-icon" width="18" height="18" draggable="false" src="/ui/theme-files/old/{{ attachment.mimeType starts with "video/" ? "film" : "photo" }}.gif"> + {% else %} + <img alt="" border="0" class="attachment-icon" width="18" height="18" draggable="false" src="/ui/theme-files/old/attachment_forbidden.gif"> + {% endif %} + </a> + {% endif %} + {% endfor %} + </div> + {% endif %} + </td> + </tr> + {% if hasOtherAttachments %} + <tr> + <td> + {% for attachment in fileAttachments %} + {% if hide_actions %} + <u>{{ attachment.name }}</u> + {% else %} + <a class="attachment" href="?_action=attachment&attachment={{ attachment.id|url_encode }}"> + {% if not canViewAttachments %} + <img alt="" class="inline-icon" width="16" height="16" border="0" draggable="false" src="/ui/theme-files/old/forbidden.gif"> + {% endif %} + {{ attachment.name }} + </a> + {% endif %} + {% endfor %} + </td> + </tr> + {% endif %} +{% endif %} |