diff options
author | Jonas Kohl | 2024-10-19 10:29:47 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-10-19 10:29:47 +0200 |
commit | 3280df23b93d6bbffbd5dfd648e01242c31f8389 (patch) | |
tree | 2ab00c00ca4ff3b671d406d064683c819a6f1411 /src/application/templates/bootstrap-3/view_topic.twig | |
parent | 75d4836c38309acc2caaeacc227c6e9079dde924 (diff) |
Fix bugs
Diffstat (limited to 'src/application/templates/bootstrap-3/view_topic.twig')
-rw-r--r-- | src/application/templates/bootstrap-3/view_topic.twig | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/application/templates/bootstrap-3/view_topic.twig b/src/application/templates/bootstrap-3/view_topic.twig index 008c336..0344fe4 100644 --- a/src/application/templates/bootstrap-3/view_topic.twig +++ b/src/application/templates/bootstrap-3/view_topic.twig @@ -13,6 +13,13 @@ or currentUser.hasPermission(permission("EDIT_OTHER_TOPIC")) ) %} +{% set couldEditPost = + currentUser is not null + and ( + currentUser.hasPermission(permission("EDIT_OWN_POST")) + or currentUser.hasPermission(permission("EDIT_OTHER_POST")) + ) %} + {% set canDelete = currentUser is not null and ( ( @@ -28,7 +35,7 @@ {% block content %} -{% if canEdit %} +{% if couldEditPost %} <div class="modal fade" tabindex="-1" role="dialog" id="diag-edit-post"> <form class="modal-dialog" role="document" action="?_action=updatepost" method="post"> <input type="hidden" id="i_edit_post" name="post"> @@ -231,6 +238,12 @@ $(function() { $("#displayHeading").show(); $("#editHeading").hide(); }); +}); +</script> +{% endif %} +{% if couldEditPost %} +<script> +$(function() { $("._edit-post").click(function() { var $post = $("#post-" + $(this).attr("data-post-id")); var $postContent = $post.find(".post-content"); |