Skip to content

Commit

Permalink
fix: NodeBB#8779, fix move all
Browse files Browse the repository at this point in the history
add new language keys
  • Loading branch information
barisusakli committed Oct 21, 2020
1 parent 1f43e98 commit e6440c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
4 changes: 3 additions & 1 deletion public/language/en-GB/topic.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
"thread_tools.merge_topics": "Merge Topics",
"thread_tools.merge": "Merge",

"topic_move_success": "This topic will be moved shortly. Click here to undo.",
"topic_move_success": "This topic will be moved to \"%1\" shortly. Click here to undo.",
"topic_move_multiple_success": "These topics will be moved to \"%1\" shortly. Click here to undo.",
"topic_move_all_success": "All topics will be moved to \"%1\" shortly. Click here to undo.",
"topic_move_undone": "Topic move undone",
"topic_move_posts_success": "Posts will be moved shortly. Click here to undo.",
"topic_move_posts_undone": "Post move undone",
Expand Down
24 changes: 12 additions & 12 deletions public/src/client/topic/move.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ define('forum/topic/move', ['categorySelector', 'alerts'], function (categorySel
return app.alertError(err.message);
}

parseModal(categories, function () {
app.parseAndTranslate('partials/move_thread_modal', {
categories: categories,
}, function (html) {
modal = $(html);
modal.on('hidden.bs.modal', function () {
modal.remove();
});
Expand All @@ -39,14 +42,6 @@ define('forum/topic/move', ['categorySelector', 'alerts'], function (categorySel
});
}

function parseModal(categories, callback) {
app.parseAndTranslate('partials/move_thread_modal', { categories: categories }, function (html) {
modal = $(html);

callback();
});
}

function onCategorySelected(category) {
selectedCategory = category;
modal.find('#move_thread_commit').prop('disabled', false);
Expand All @@ -59,11 +54,16 @@ define('forum/topic/move', ['categorySelector', 'alerts'], function (categorySel
commitEl.prop('disabled', true);

modal.modal('hide');

var message = '[[topic:topic_move_success, ' + selectedCategory.name + ']]';
if (Move.tids && Move.tids.length > 1) {
message = '[[topic:topic_move_multiple_success, ' + selectedCategory.name + ']]';
} else if (!Move.tids) {
message = '[[topic:topic_move_all_success, ' + selectedCategory.name + ']]';
}
alerts.alert({
alert_id: 'tids_move_' + Move.tids.join('-'),
alert_id: 'tids_move_' + (Move.tids ? Move.tids.join('-') : 'all'),
title: '[[topic:thread_tools.move]]',
message: '[[topic:topic_move_success, ' + selectedCategory.name + ']]',
message: message,
type: 'success',
timeout: 10000,
timeoutfn: function () {
Expand Down

0 comments on commit e6440c0

Please sign in to comment.