v1.18.x
Julian Lam 9 years ago
parent 3e46ef8c35
commit 99e9508131

@ -6,8 +6,7 @@ define('forum/topic/move', function() {
var Move = {}, var Move = {},
modal, modal,
targetCid, selectedEl;
targetCategoryLabel;
Move.init = function(tids, currentCid, onComplete) { Move.init = function(tids, currentCid, onComplete) {
Move.tids = tids; Move.tids = tids;
@ -70,6 +69,8 @@ define('forum/topic/move', function() {
} }
categoryEl.toggleClass('disabled', !!category.disabled); categoryEl.toggleClass('disabled', !!category.disabled);
categoryEl.attr('data-cid', category.cid); categoryEl.attr('data-cid', category.cid);
categoryEl.attr('data-icon', category.icon);
categoryEl.attr('data-name', category.name);
categoryEl.html('<i class="fa fa-fw ' + category.icon + '"></i> ' + category.name); categoryEl.html('<i class="fa fa-fw ' + category.icon + '"></i> ' + category.name);
parentEl.append(level); parentEl.append(level);
@ -88,15 +89,14 @@ define('forum/topic/move', function() {
modal.find('#confirm-category-name').html(category.html()); modal.find('#confirm-category-name').html(category.html());
modal.find('#move-confirm').removeClass('hide'); modal.find('#move-confirm').removeClass('hide');
targetCid = category.attr('data-cid'); selectedEl = category;
targetCategoryLabel = category.html();
modal.find('#move_thread_commit').prop('disabled', false); modal.find('#move_thread_commit').prop('disabled', false);
} }
function onCommitClicked() { function onCommitClicked() {
var commitEl = modal.find('#move_thread_commit'); var commitEl = modal.find('#move_thread_commit');
if (!commitEl.prop('disabled') && targetCid) { if (!commitEl.prop('disabled') && selectedEl.attr('data-cid')) {
commitEl.prop('disabled', true); commitEl.prop('disabled', true);
moveTopics(); moveTopics();
@ -106,7 +106,7 @@ define('forum/topic/move', function() {
function moveTopics() { function moveTopics() {
socket.emit(Move.moveAll ? 'topics.moveAll' : 'topics.move', { socket.emit(Move.moveAll ? 'topics.moveAll' : 'topics.move', {
tids: Move.tids, tids: Move.tids,
cid: targetCid, cid: selectedEl.attr('data-cid'),
currentCid: Move.currentCid currentCid: Move.currentCid
}, function(err) { }, function(err) {
modal.modal('hide'); modal.modal('hide');
@ -115,7 +115,7 @@ define('forum/topic/move', function() {
return app.alertError(err.message); return app.alertError(err.message);
} }
app.alertSuccess('[[topic:topic_move_success, ' + targetCategoryLabel + ']]'); app.alertSuccess('[[topic:topic_move_success, ' + selectedEl.attr('data-name') + ']] <i class="fa fa-fw ' + selectedEl.attr('data-icon') + '"></i>');
if (typeof Move.onComplete === 'function') { if (typeof Move.onComplete === 'function') {
Move.onComplete(); Move.onComplete();
} }

Loading…
Cancel
Save