mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 21:55:40 +08:00
if you try posting a reply and are looking at a different topic, pop this window up
This commit is contained in:
parent
ec59cbc73f
commit
91b507f4c4
@ -27,11 +27,56 @@ Discourse.ComposerController = Discourse.Controller.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
save: function() {
|
save: function(force) {
|
||||||
var composer,
|
var composer,
|
||||||
_this = this;
|
_this = this,
|
||||||
|
topic,
|
||||||
|
message,
|
||||||
|
buttons;
|
||||||
|
|
||||||
composer = this.get('content');
|
composer = this.get('content');
|
||||||
composer.set('disableDrafts', true);
|
composer.set('disableDrafts', true);
|
||||||
|
|
||||||
|
// for now handle a very narrow use case
|
||||||
|
// if we are replying to a topic AND not on the topic pop the window up
|
||||||
|
|
||||||
|
if(!force && composer.get('replyingToTopic')) {
|
||||||
|
topic = this.get('topic');
|
||||||
|
if (!topic || topic.get('id') !== composer.get('topic.id'))
|
||||||
|
{
|
||||||
|
message = Em.String.i18n("composer.posting_not_on_topic", {title: this.get('content.topic.title')});
|
||||||
|
|
||||||
|
buttons = [{
|
||||||
|
"label": Em.String.i18n("composer.cancel"),
|
||||||
|
"class": "btn"
|
||||||
|
}];
|
||||||
|
|
||||||
|
buttons.push({
|
||||||
|
"label": Em.String.i18n("composer.reply_original"),
|
||||||
|
"class": "btn-primary",
|
||||||
|
"callback": function(){
|
||||||
|
_this.save(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(topic) {
|
||||||
|
buttons.push({
|
||||||
|
"label": Em.String.i18n("composer.reply_here"),
|
||||||
|
"class": "btn-primary",
|
||||||
|
"callback": function(){
|
||||||
|
composer.set('topic', topic);
|
||||||
|
composer.set('post', null);
|
||||||
|
_this.save(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
bootbox.dialog(message, buttons);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return composer.save({
|
return composer.save({
|
||||||
imageSizes: this.get('view').imageSizes()
|
imageSizes: this.get('view').imageSizes()
|
||||||
}).then(function(opts) {
|
}).then(function(opts) {
|
||||||
|
@ -44,6 +44,10 @@ Discourse.Composer = Discourse.Model.extend({
|
|||||||
return this.get('action') === EDIT;
|
return this.get('action') === EDIT;
|
||||||
}).property('action'),
|
}).property('action'),
|
||||||
|
|
||||||
|
replyingToTopic: (function() {
|
||||||
|
return this.get('action') === REPLY;
|
||||||
|
}).property('action'),
|
||||||
|
|
||||||
viewOpen: (function() {
|
viewOpen: (function() {
|
||||||
return this.get('composeState') === OPEN;
|
return this.get('composeState') === OPEN;
|
||||||
}).property('composeState'),
|
}).property('composeState'),
|
||||||
|
@ -27,6 +27,8 @@ Discourse.TopicRoute = Discourse.Route.extend({
|
|||||||
topicController = this.controllerFor('topic');
|
topicController = this.controllerFor('topic');
|
||||||
topicController.cancelFilter();
|
topicController.cancelFilter();
|
||||||
topicController.set('multiSelect', false);
|
topicController.set('multiSelect', false);
|
||||||
|
this.controllerFor('composer').set('topic', null);
|
||||||
|
|
||||||
if (headerController = this.controllerFor('header')) {
|
if (headerController = this.controllerFor('header')) {
|
||||||
headerController.set('topic', null);
|
headerController.set('topic', null);
|
||||||
headerController.set('showExtraInfo', false);
|
headerController.set('showExtraInfo', false);
|
||||||
@ -35,6 +37,7 @@ Discourse.TopicRoute = Discourse.Route.extend({
|
|||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
this.controllerFor('header').set('topic', model);
|
this.controllerFor('header').set('topic', model);
|
||||||
|
this.controllerFor('composer').set('topic', model);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -260,6 +260,7 @@ en:
|
|||||||
message: "Authenticating with Persona (make sure pop up blockers are not enabled)"
|
message: "Authenticating with Persona (make sure pop up blockers are not enabled)"
|
||||||
|
|
||||||
composer:
|
composer:
|
||||||
|
posting_not_on_topic: "You have composed a reply to \"{{title}}\", however you are no longer looking at that topic."
|
||||||
saving_draft_tip: "saving"
|
saving_draft_tip: "saving"
|
||||||
saved_draft_tip: "saved"
|
saved_draft_tip: "saved"
|
||||||
saved_local_draft_tip: "saved locally"
|
saved_local_draft_tip: "saved locally"
|
||||||
@ -269,7 +270,10 @@ en:
|
|||||||
more: "{{n}} to go..."
|
more: "{{n}} to go..."
|
||||||
|
|
||||||
save_edit: "Save Edit"
|
save_edit: "Save Edit"
|
||||||
|
reply_original: "Reply on Original Topic"
|
||||||
|
reply_here: "Reply Here"
|
||||||
reply: "Reply"
|
reply: "Reply"
|
||||||
|
cancel: "Cancel"
|
||||||
create_topic: "Create Topic"
|
create_topic: "Create Topic"
|
||||||
create_pm: "Create Private Message"
|
create_pm: "Create Private Message"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user