From c4bdeae06e988fe954b032ec5e759079858ff79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 9 Jun 2020 15:26:41 -0400 Subject: [PATCH] feat: merge improvements wip --- Gruntfile.js | 3 +++ public/language/en-GB/topic.json | 6 +++++- public/language/en-US/topic.json | 6 +++++- public/src/client/topic/merge.js | 23 ++++++++++++++++++----- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4ed9949c6e..e25d9e12dd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -45,6 +45,9 @@ module.exports = function (grunt) { if (!plugins.includes('nodebb-plugin-composer-default')) { plugins.push('nodebb-plugin-composer-default'); } + if (!plugins.includes('nodebb-theme-persona')) { + plugins.push('nodebb-theme-persona'); + } } const styleUpdated_Client = plugins.map(p => 'node_modules/' + p + '/*.less') diff --git a/public/language/en-GB/topic.json b/public/language/en-GB/topic.json index 5fb113f8d4..06232945cb 100644 --- a/public/language/en-GB/topic.json +++ b/public/language/en-GB/topic.json @@ -115,7 +115,11 @@ "fork_pid_count": "%1 post(s) selected", "fork_success": "Successfully forked topic! Click here to go to the forked topic.", "delete_posts_instruction": "Click the posts you want to delete/purge", - "merge_topics_instruction": "Click the topics you want to merge", + "merge_topics_instruction": "Click the topics you want to merge or search for them", + "merge-topic-list-title": "List of topics to be merged", + "merge-options": "Merge options", + "merge-select-main-topic": "Select the main topic", + "merge-new-title-for-topic": "New title for topic", "move_posts_instruction": "Click the posts you want to move", "change_owner_instruction": "Click the posts you want to assign to another user", diff --git a/public/language/en-US/topic.json b/public/language/en-US/topic.json index 100027b6eb..d9a3ba9251 100644 --- a/public/language/en-US/topic.json +++ b/public/language/en-US/topic.json @@ -99,7 +99,11 @@ "fork_pid_count": "%1 post(s) selected", "fork_success": "Successfully forked topic! Click here to go to the forked topic.", "delete_posts_instruction": "Click the posts you want to delete/purge", - "merge_topics_instruction": "Click the topics you want to merge", + "merge_topics_instruction": "Click the topics you want to merge or search for them", + "merge-topic-list-title": "List of topics to be merged", + "merge-options": "Merge options", + "merge-select-main-topic": "Select the main topic", + "merge-new-title-for-topic": "New title for topic", "move_posts_instruction": "Click the posts you want to move", "change_owner_instruction": "Click the posts you want to assign to another user", "composer.title_placeholder": "Enter your topic title here...", diff --git a/public/src/client/topic/merge.js b/public/src/client/topic/merge.js index 85df00636c..8b8b6846fb 100644 --- a/public/src/client/topic/merge.js +++ b/public/src/client/topic/merge.js @@ -8,7 +8,8 @@ define('forum/topic/merge', function () { var selectedTids = {}; - Merge.init = function () { + Merge.init = function (callback) { + callback = callback || function () {}; if (modal) { return; } @@ -28,11 +29,12 @@ define('forum/topic/merge', function () { mergeBtn.on('click', function () { mergeTopics(mergeBtn); }); + callback(); }); }; - function onTopicClicked(ev) { - var tid = $(this).parents('[component="category/topic"]').attr('data-tid'); + Merge.addTopic = function (tid, callback) { + callback = callback || function () {}; socket.emit('topics.getTopic', tid, function (err, topicData) { if (err) { return app.alertError(err); @@ -45,7 +47,14 @@ define('forum/topic/merge', function () { } checkButtonEnable(); showTopicsSelected(); + callback(); }); + }; + + function onTopicClicked(ev) { + var tid = $(this).parents('[component="category/topic"]').attr('data-tid'); + Merge.addTopic(tid); + ev.preventDefault(); ev.stopPropagation(); return false; @@ -75,8 +84,12 @@ define('forum/topic/merge', function () { }); if (tids.length) { - app.parseAndTranslate('partials/merge_topics_modal', 'topics', { topics: topics }, function (html) { - modal.find('.topics-section').html(html); + app.parseAndTranslate('partials/merge_topics_modal', { + config: config, + topics: topics, + }, function (html) { + modal.find('.topics-section').html(html.find('.topics-section').html()); + modal.find('.main-topic-select').html(html.find('.main-topic-select').html()); }); } else { modal.find('.topics-section').translateHtml('[[error:no-topics-selected]]');