summaryrefslogtreecommitdiff
path: root/src/application/templates/bootstrap-3
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/templates/bootstrap-3')
-rw-r--r--src/application/templates/bootstrap-3/search.twig4
-rw-r--r--src/application/templates/bootstrap-3/view_topic.twig15
2 files changed, 16 insertions, 3 deletions
diff --git a/src/application/templates/bootstrap-3/search.twig b/src/application/templates/bootstrap-3/search.twig
index c8f6315..66bd764 100644
--- a/src/application/templates/bootstrap-3/search.twig
+++ b/src/application/templates/bootstrap-3/search.twig
@@ -46,8 +46,8 @@
"author": '<em>' ~ (postAuthor ? postAuthor.displayName : __("unknown"))|e("html") ~ '</em>',
"post_date": '<span class="_time">' ~ post.postDate.format("c")|e("html") ~ '</span>',
"topic": '<em>'
- ~ (topics[post.topicId].isLocked ? '<span class="fa fa-lock text-muted" aria-hidden="true"></span> ' : '')
- ~ (topics[post.topicId] ? topics[post.topicId].title : null)|default("unknown")|e("html") ~ '</em>',
+ ~ (ctx.topics[post.topicId].isLocked ? '<span class="fa fa-lock text-muted" aria-hidden="true"></span> ' : '')
+ ~ (ctx.topics[post.topicId] ? ctx.topics[post.topicId].title : null)|default(__("unknown"))|e("html") ~ '</em>',
}) }}</span>
</a>
{% endfor %}
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");