From f8af900415677ac1798e2c0fbed82c1461b4c1e1 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 17 Mar 2015 14:45:06 -0400 Subject: [PATCH] post button components --- NOTES.md | 10 +++++++++- public/src/client/topic/posts.js | 12 +++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/NOTES.md b/NOTES.md index 256ac57163..0bc8d51d76 100644 --- a/NOTES.md +++ b/NOTES.md @@ -6,4 +6,12 @@ Deprecation TODO's for post - 0.7x - remove all pre-0.7x compatibility selectors for: .post-content .topic-title - .post_reply \ No newline at end of file + .post_reply + .edit + .delete + .purge + .move + .reply + .quote + .chat + .flag \ No newline at end of file diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index b9e70cb34d..e91494dc38 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -164,17 +164,19 @@ define('forum/topic/posts', [ } function toggleModTools(pid, privileges) { - var postEl = components.get('post', 'pid', pid); + var postEl = components.get('post', 'pid', pid), + isSelfPost = parseInt(postEl.attr('data-uid'), 10) === parseInt(app.user.uid, 10); if (!privileges.editable) { - postEl.find('.edit, .delete, .purge').remove(); + postEl.find('.edit, .delete, .purge, [component="post/edit"], [component="post/delete"], [component="post/purge"]').remove(); } + if (!privileges.move) { - postEl.find('.move').remove(); + postEl.find('.move, [component="post/move"]').remove(); } + postEl.find('.reply, .quote').toggleClass('hidden', !$('.post_reply, [component="post/reply"]').length); - var isSelfPost = parseInt(postEl.attr('data-uid'), 10) === parseInt(app.user.uid, 10); - postEl.find('.chat, .flag').toggleClass('hidden', isSelfPost || !app.user.uid); + postEl.find('.chat, .flag, [component="user/chat"], [component="post/flag"]').toggleClass('hidden', isSelfPost || !app.user.uid); } Posts.loadMorePosts = function(direction) {