mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 15:30:39 +01:00
closes #1371
adds a dropdown to category view to move/pin/lock/delete multiple topics
This commit is contained in:
36
public/src/modules/topicSelect.js
Normal file
36
public/src/modules/topicSelect.js
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
/* globals define*/
|
||||
|
||||
define(function() {
|
||||
var TopicSelect = {};
|
||||
|
||||
TopicSelect.init = function(onSelect) {
|
||||
$('#topics-container').on('click', '.select', function() {
|
||||
var select = $(this);
|
||||
var isChecked = !select.hasClass('fa-square-o');
|
||||
|
||||
select.toggleClass('fa-check-square-o', !isChecked);
|
||||
select.toggleClass('fa-square-o', isChecked);
|
||||
select.parents('.category-item').toggleClass('selected', !isChecked);
|
||||
if (typeof onSelect === 'function') {
|
||||
onSelect();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
TopicSelect.getSelectedTids = function() {
|
||||
var tids = [];
|
||||
$('#topics-container .category-item.selected').each(function() {
|
||||
tids.push($(this).attr('data-tid'));
|
||||
});
|
||||
return tids;
|
||||
};
|
||||
|
||||
TopicSelect.unselectAll = function() {
|
||||
$('#topics-container .category-item.selected').removeClass('selected');
|
||||
$('#topics-container .select').toggleClass('fa-check-square-o', false).toggleClass('fa-square-o', true);
|
||||
};
|
||||
|
||||
return TopicSelect;
|
||||
});
|
||||
Reference in New Issue
Block a user