From 99e95081316f528ffac2d678708796db7e3581f0 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 26 Feb 2016 14:47:30 -0500 Subject: [PATCH] fixed #4270 --- public/src/client/topic/move.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public/src/client/topic/move.js b/public/src/client/topic/move.js index d013e1c09d..d16eb9bc41 100644 --- a/public/src/client/topic/move.js +++ b/public/src/client/topic/move.js @@ -6,8 +6,7 @@ define('forum/topic/move', function() { var Move = {}, modal, - targetCid, - targetCategoryLabel; + selectedEl; Move.init = function(tids, currentCid, onComplete) { Move.tids = tids; @@ -70,6 +69,8 @@ define('forum/topic/move', function() { } categoryEl.toggleClass('disabled', !!category.disabled); categoryEl.attr('data-cid', category.cid); + categoryEl.attr('data-icon', category.icon); + categoryEl.attr('data-name', category.name); categoryEl.html(' ' + category.name); parentEl.append(level); @@ -88,15 +89,14 @@ define('forum/topic/move', function() { modal.find('#confirm-category-name').html(category.html()); modal.find('#move-confirm').removeClass('hide'); - targetCid = category.attr('data-cid'); - targetCategoryLabel = category.html(); + selectedEl = category; modal.find('#move_thread_commit').prop('disabled', false); } function onCommitClicked() { var commitEl = modal.find('#move_thread_commit'); - if (!commitEl.prop('disabled') && targetCid) { + if (!commitEl.prop('disabled') && selectedEl.attr('data-cid')) { commitEl.prop('disabled', true); moveTopics(); @@ -106,7 +106,7 @@ define('forum/topic/move', function() { function moveTopics() { socket.emit(Move.moveAll ? 'topics.moveAll' : 'topics.move', { tids: Move.tids, - cid: targetCid, + cid: selectedEl.attr('data-cid'), currentCid: Move.currentCid }, function(err) { modal.modal('hide'); @@ -115,7 +115,7 @@ define('forum/topic/move', function() { return app.alertError(err.message); } - app.alertSuccess('[[topic:topic_move_success, ' + targetCategoryLabel + ']]'); + app.alertSuccess('[[topic:topic_move_success, ' + selectedEl.attr('data-name') + ']] '); if (typeof Move.onComplete === 'function') { Move.onComplete(); }