voters info

This commit is contained in:
barisusakli
2014-11-15 12:37:22 -05:00
parent 8330a6e6d9
commit 9d56f50967
2 changed files with 57 additions and 0 deletions

View File

@@ -94,6 +94,10 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com
return toggleVote($(this), '.downvoted', 'posts.downvote');
});
postContainer.on('click', '.votes', function() {
showVotes(getData($(this), 'data-pid'));
});
postContainer.on('click', '.flag', function() {
flagPost(getData($(this), 'data-pid'));
});
@@ -194,6 +198,30 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com
return false;
}
function showVotes(pid) {
if (!app.isAdmin) {
return;
}
socket.emit('admin.getVoters', pid, function(err, data) {
if (err) {
return app.alertError(err.message);
}
templates.parse('partials/modals/votes_modal', data, function(html) {
var dialog = bootbox.dialog({
title: 'Voters',
message: html,
className: 'vote-modal',
show: true
});
dialog.on('click', function() {
dialog.modal('hide');
});
});
});
}
function getData(button, data) {
return button.parents('.post-row').attr(data);
}