From fffed299137d46fc6d08fdd73face332d9aecdb7 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 17 Mar 2015 15:35:32 -0400 Subject: [PATCH] post/favourite-count component --- public/src/client/topic/events.js | 2 +- public/src/client/topic/postTools.js | 2 +- public/src/components.js | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/public/src/client/topic/events.js b/public/src/client/topic/events.js index 6c6887b71f..614202c160 100644 --- a/public/src/client/topic/events.js +++ b/public/src/client/topic/events.js @@ -69,7 +69,7 @@ define('forum/topic/events', [ }; function updatePostVotesAndUserReputation(data) { - var votes = components.get('post/votes', data.post.pid), + var votes = components.get('post/vote-count', data.post.pid), reputationElements = $('.reputation[data-uid="' + data.post.uid + '"]'); votes.html(data.post.votes).attr('data-votes', data.post.votes); diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index ef824fc3bf..247623943c 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -102,7 +102,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com return toggleVote($(this), '.downvoted', 'posts.downvote'); }); - postContainer.on('click', '.votes, [component="post/votes"]', function() { + postContainer.on('click', '.votes, [component="post/vote-count"]', function() { showVotes(getData($(this), 'data-pid')); }); diff --git a/public/src/components.js b/public/src/components.js index d1d61e5769..6014c14184 100644 --- a/public/src/components.js +++ b/public/src/components.js @@ -19,10 +19,15 @@ var components = components || {}; var el = components.core.post('index', index).find('[component="post/anchor"]'); return el.length ? el : $('#post_anchor_' + index); // deprecated after 0.7x }, - 'post/votes': function(pid) { - var el = components.core.post('pid', pid).find('[component="post/votes"]'); + 'post/vote-count': function(pid) { + var el = components.core.post('pid', pid).find('[component="post/vote-count"]'); return el.length ? el : components.core.post('pid', pid).find('.votes'); // deprecated after 0.7x }, + 'post/favourite-count': function(pid) { + var el = components.core.post('pid', pid).find('[component="post/favourite-count"]'); + return el.length ? el : components.core.post('pid', pid).find('.favouriteCount'); // deprecated after 0.7x + }, + 'user/postcount': function(uid) { var el = $('[component="user/postcount"][data-uid="' + uid + '"]'); return el.length ? el : $('.user_postcount_' + uid); // deprecated after 0.7x