mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Remove modal state to choose move type. Instead use two buttons on the multi select popup, one
for split and one for merge.
This commit is contained in:
parent
1e9497d9ef
commit
7daca77443
9 changed files with 44 additions and 81 deletions
|
@ -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')
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
<p>{{{i18n topic.move_selected.existing_topic.instructions count="view.selectedPostsCount"}}}</p>
|
||||
<p>{{{i18n topic.merge_topic.instructions count="view.selectedPostsCount"}}}</p>
|
||||
|
||||
{{view Discourse.ChooseTopicView selectedTopicIdBinding="view.selectedTopicId"}}
|
||||
</div>
|
|
@ -1,8 +0,0 @@
|
|||
<div id='move-selected' class="modal-body">
|
||||
|
||||
<p>{{{i18n topic.move_selected.instructions count="view.selectedPostsCount"}}}</p>
|
||||
|
||||
<button {{action showMoveNewTopic target="view"}} class="btn">{{i18n topic.move_selected.new_topic.title}}</button>
|
||||
<button {{action showMoveExistingTopic target="view"}} class="btn">{{i18n topic.move_selected.existing_topic.title}}</button>
|
||||
|
||||
</div>
|
|
@ -5,10 +5,10 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{{i18n topic.move_selected.new_topic.instructions count="view.selectedPostsCount"}}}
|
||||
{{{i18n topic.split_topic.instructions count="view.selectedPostsCount"}}}
|
||||
|
||||
<form>
|
||||
<label>{{i18n topic.move_selected.new_topic.topic_name}}</label>
|
||||
<label>{{i18n topic.split_topic.topic_name}}</label>
|
||||
{{view Discourse.TextField valueBinding="view.topicName" placeholderKey="composer.title_placeholder"}}
|
||||
</form>
|
||||
|
|
@ -5,7 +5,8 @@
|
|||
{{/if}}
|
||||
|
||||
{{#if canMoveSelected}}
|
||||
<button class='btn' {{action moveSelected}}><i class='icon icon-move'></i> {{i18n topic.multi_select.move}}</button>
|
||||
<button class='btn' {{action splitTopic}}><i class='icon icon-move'></i> {{i18n topic.split_topic.action}}</button>
|
||||
<button class='btn' {{action mergeTopic}}><i class='icon icon-move'></i> {{i18n topic.merge_topic.action}}}</button>
|
||||
{{/if}}
|
||||
|
||||
<p class='cancel'><a href='#' {{action toggleMultiSelect}}>{{i18n topic.multi_select.cancel}}</a></p>
|
||||
|
|
|
@ -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;
|
|
@ -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')
|
||||
}));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -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;
|
|
@ -601,22 +601,19 @@ 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."
|
||||
instructions:
|
||||
one: "How would you like to move this post?"
|
||||
other: "How would you like to move the <b>{{count}}</b> posts you've selected?"
|
||||
|
||||
new_topic:
|
||||
title: "Move Selected Posts to a New Topic"
|
||||
split_topic:
|
||||
title: "Split Topic"
|
||||
action: "split topic"
|
||||
topic_name: "New Topic Name:"
|
||||
error: "There was an error splitting that topic."
|
||||
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 <b>{{count}}</b> posts you've selected."
|
||||
|
||||
existing_topic:
|
||||
title: "Move Selected Posts to an Existing Topic"
|
||||
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 <b>{{count}}</b> posts to."
|
||||
|
@ -626,7 +623,6 @@ en:
|
|||
selected: 'selected ({{count}})'
|
||||
delete: delete selected
|
||||
cancel: cancel selecting
|
||||
move: move selected
|
||||
description:
|
||||
one: You have selected <b>1</b> post.
|
||||
other: "You have selected <b>{{count}}</b> posts."
|
||||
|
|
Loading…
Reference in a new issue