diff --git a/app/assets/javascripts/discourse/controllers/topic_controller.js b/app/assets/javascripts/discourse/controllers/topic_controller.js index 51e8af5dd..29e0fd5fe 100644 --- a/app/assets/javascripts/discourse/controllers/topic_controller.js +++ b/app/assets/javascripts/discourse/controllers/topic_controller.js @@ -72,11 +72,22 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected this.toggleProperty('summaryCollapsed'); }, - moveSelected: function() { + splitTopic: function() { var modalController = this.get('controllers.modal'); if (!modalController) return; - modalController.show(Discourse.MoveSelectedView.create({ + modalController.show(Discourse.SplitTopicView.create({ + topicController: this, + topic: this.get('content'), + selectedPosts: this.get('selectedPosts') + })); + }, + + mergeTopic: function() { + var modalController = this.get('controllers.modal'); + if (!modalController) return; + + modalController.show(Discourse.MergeTopicView.create({ topicController: this, topic: this.get('content'), selectedPosts: this.get('selectedPosts') diff --git a/app/assets/javascripts/discourse/templates/modal/move_selected_existing_topic.js.handlebars b/app/assets/javascripts/discourse/templates/modal/merge_topic.js.handlebars similarity index 82% rename from app/assets/javascripts/discourse/templates/modal/move_selected_existing_topic.js.handlebars rename to app/assets/javascripts/discourse/templates/modal/merge_topic.js.handlebars index 8fbc1febe..2f3325bb4 100644 --- a/app/assets/javascripts/discourse/templates/modal/move_selected_existing_topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/merge_topic.js.handlebars @@ -5,7 +5,7 @@ {{/if}} -

{{{i18n topic.move_selected.existing_topic.instructions count="view.selectedPostsCount"}}}

+

{{{i18n topic.merge_topic.instructions count="view.selectedPostsCount"}}}

{{view Discourse.ChooseTopicView selectedTopicIdBinding="view.selectedTopicId"}} diff --git a/app/assets/javascripts/discourse/templates/modal/move_selected.js.handlebars b/app/assets/javascripts/discourse/templates/modal/move_selected.js.handlebars deleted file mode 100644 index 4946725cc..000000000 --- a/app/assets/javascripts/discourse/templates/modal/move_selected.js.handlebars +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/app/assets/javascripts/discourse/templates/modal/move_selected_new_topic.js.handlebars b/app/assets/javascripts/discourse/templates/modal/split_topic.js.handlebars similarity index 76% rename from app/assets/javascripts/discourse/templates/modal/move_selected_new_topic.js.handlebars rename to app/assets/javascripts/discourse/templates/modal/split_topic.js.handlebars index 430fa5528..c5ab49dff 100644 --- a/app/assets/javascripts/discourse/templates/modal/move_selected_new_topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/split_topic.js.handlebars @@ -5,10 +5,10 @@ {{/if}} - {{{i18n topic.move_selected.new_topic.instructions count="view.selectedPostsCount"}}} + {{{i18n topic.split_topic.instructions count="view.selectedPostsCount"}}}
- + {{view Discourse.TextField valueBinding="view.topicName" placeholderKey="composer.title_placeholder"}}
diff --git a/app/assets/javascripts/discourse/templates/selected_posts.js.handlebars b/app/assets/javascripts/discourse/templates/selected_posts.js.handlebars index a306dc1a2..537058c9e 100644 --- a/app/assets/javascripts/discourse/templates/selected_posts.js.handlebars +++ b/app/assets/javascripts/discourse/templates/selected_posts.js.handlebars @@ -5,7 +5,8 @@ {{/if}} {{#if canMoveSelected}} - + + {{/if}}

{{i18n topic.multi_select.cancel}}

diff --git a/app/assets/javascripts/discourse/views/modal/move_selected_existing_topic_view.js b/app/assets/javascripts/discourse/views/modal/merge_topic_view.js similarity index 73% rename from app/assets/javascripts/discourse/views/modal/move_selected_existing_topic_view.js rename to app/assets/javascripts/discourse/views/modal/merge_topic_view.js index 58ef5595b..4ae99526b 100644 --- a/app/assets/javascripts/discourse/views/modal/move_selected_existing_topic_view.js +++ b/app/assets/javascripts/discourse/views/modal/merge_topic_view.js @@ -1,14 +1,14 @@ /** A modal view for handling moving of posts to an existing topic - @class MoveSelectedExistingTopicView + @class MergeTopicView @extends Discourse.ModalBodyView @namespace Discourse @module Discourse **/ -Discourse.MoveSelectedExistingTopicView = Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, { - templateName: 'modal/move_selected_existing_topic', - title: Em.String.i18n('topic.move_selected.existing_topic.title'), +Discourse.MergeTopicView = Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, { + templateName: 'modal/merge_topic', + title: Em.String.i18n('topic.merge_topic.title'), buttonDisabled: function() { if (this.get('saving')) return true; @@ -17,7 +17,7 @@ Discourse.MoveSelectedExistingTopicView = Discourse.ModalBodyView.extend(Discour buttonTitle: function() { if (this.get('saving')) return Em.String.i18n('saving'); - return Em.String.i18n('topic.move_selected.title'); + return Em.String.i18n('topic.merge_topic.title'); }.property('saving'), movePostsToExistingTopic: function() { @@ -36,7 +36,7 @@ Discourse.MoveSelectedExistingTopicView = Discourse.ModalBodyView.extend(Discour Em.run.next(function() { Discourse.URL.routeTo(result.url); }); }, function() { // Error moving posts - moveSelectedView.flash(Em.String.i18n('topic.move_selected.error')); + moveSelectedView.flash(Em.String.i18n('topic.merge_topic.error')); moveSelectedView.set('saving', false); }); return false; diff --git a/app/assets/javascripts/discourse/views/modal/move_selected_view.js b/app/assets/javascripts/discourse/views/modal/move_selected_view.js deleted file mode 100644 index 7c155aa1d..000000000 --- a/app/assets/javascripts/discourse/views/modal/move_selected_view.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - A modal view for handling moving of posts. - - @class MoveSelectedView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.MoveSelectedView = Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, { - templateName: 'modal/move_selected', - title: Em.String.i18n('topic.move_selected.title'), - - showMoveNewTopic: function() { - var modalController = this.get('controller'); - if (!modalController) return; - - modalController.show(Discourse.MoveSelectedNewTopicView.create({ - topicController: this.get('topicController'), - topic: this.get('topic'), - selectedPosts: this.get('selectedPosts') - })); - }, - - showMoveExistingTopic: function() { - var modalController = this.get('controller'); - if (!modalController) return; - - modalController.show(Discourse.MoveSelectedExistingTopicView.create({ - topicController: this.get('topicController'), - topic: this.get('topic'), - selectedPosts: this.get('selectedPosts') - })); - } - -}); - - diff --git a/app/assets/javascripts/discourse/views/modal/move_selected_new_topic_view.js b/app/assets/javascripts/discourse/views/modal/split_topic_view.js similarity index 74% rename from app/assets/javascripts/discourse/views/modal/move_selected_new_topic_view.js rename to app/assets/javascripts/discourse/views/modal/split_topic_view.js index 2f2ce0a95..de5a178fb 100644 --- a/app/assets/javascripts/discourse/views/modal/move_selected_new_topic_view.js +++ b/app/assets/javascripts/discourse/views/modal/split_topic_view.js @@ -1,14 +1,14 @@ /** A modal view for handling moving of posts to a new topic - @class MoveSelectedNewTopicView + @class SplitTopicView @extends Discourse.ModalBodyView @namespace Discourse @module Discourse **/ -Discourse.MoveSelectedNewTopicView = Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, { - templateName: 'modal/move_selected_new_topic', - title: Em.String.i18n('topic.move_selected.new_topic.title'), +Discourse.SplitTopicView = Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, { + templateName: 'modal/split_topic', + title: Em.String.i18n('topic.split_topic.title'), saving: false, buttonDisabled: function() { @@ -18,7 +18,7 @@ Discourse.MoveSelectedNewTopicView = Discourse.ModalBodyView.extend(Discourse.Se buttonTitle: function() { if (this.get('saving')) return Em.String.i18n('saving'); - return Em.String.i18n('topic.move_selected.title'); + return Em.String.i18n('topic.split_topic.action'); }.property('saving'), movePostsToNewTopic: function() { @@ -37,7 +37,7 @@ Discourse.MoveSelectedNewTopicView = Discourse.ModalBodyView.extend(Discourse.Se Em.run.next(function() { Discourse.URL.routeTo(result.url); }); }, function() { // Error moving posts - moveSelectedView.flash(Em.String.i18n('topic.move_selected.error')); + moveSelectedView.flash(Em.String.i18n('topic.split_topic.error')); moveSelectedView.set('saving', false); }); return false; diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index f0a08aca5..db2552f0c 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -601,32 +601,28 @@ en: other: "of {{count}} in the topic" cancel: "Show all posts in this topic again." - move_selected: - title: "Move Selected Posts" - error: "Sorry, there was an error moving those posts." + split_topic: + title: "Split Topic" + action: "split topic" + topic_name: "New Topic Name:" + error: "There was an error splitting that topic." instructions: - one: "How would you like to move this post?" - other: "How would you like to move the {{count}} posts you've selected?" + one: "You are about to create a new topic and populate it with the post you've selected." + other: "You are about to create a new topic and populate it with the {{count}} posts you've selected." - new_topic: - title: "Move Selected Posts to a New Topic" - topic_name: "New Topic Name:" - instructions: - one: "You are about to create a new topic and populate it with the post you've selected." - other: "You are about to create a new topic and populate it with the {{count}} posts you've selected." - - existing_topic: - title: "Move Selected Posts to an Existing Topic" - instructions: - one: "Please choose the topic you'd like to move that post to." - other: "Please choose the topic you'd like to move those {{count}} posts to." + merge_topic: + title: "Merge Topic" + action: "merge topic" + error: "There was an error merging that topic." + instructions: + one: "Please choose the topic you'd like to move that post to." + other: "Please choose the topic you'd like to move those {{count}} posts to." multi_select: select: 'select' selected: 'selected ({{count}})' delete: delete selected cancel: cancel selecting - move: move selected description: one: You have selected 1 post. other: "You have selected {{count}} posts."