diff options
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"); |