mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
voters info
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user