mirror of
https://github.com/flarum/core.git
synced 2025-07-30 21:20:24 +02:00
Composer and replying tweaks/bug-fixes
This commit is contained in:
@@ -27,6 +27,7 @@ export default Ember.Controller.extend(Ember.Evented, {
|
||||
this.confirmExit().then(function() {
|
||||
composer.set('content', null);
|
||||
Ember.run.next(function() {
|
||||
newContent.set('composer', composer);
|
||||
composer.set('content', newContent);
|
||||
});
|
||||
});
|
||||
@@ -61,10 +62,10 @@ export default Ember.Controller.extend(Ember.Evented, {
|
||||
|
||||
hide: function() {
|
||||
this.set('position', PositionEnum.HIDDEN);
|
||||
var content = this.get('content');
|
||||
if (content) {
|
||||
content.send('reset');
|
||||
}
|
||||
},
|
||||
|
||||
clearContent: function() {
|
||||
this.set('content', null);
|
||||
},
|
||||
|
||||
close: function() {
|
||||
@@ -75,17 +76,23 @@ export default Ember.Controller.extend(Ember.Evented, {
|
||||
},
|
||||
|
||||
minimize: function() {
|
||||
this.set('position', PositionEnum.MINIMIZED);
|
||||
if (this.get('position') !== PositionEnum.HIDDEN) {
|
||||
this.set('position', PositionEnum.MINIMIZED);
|
||||
}
|
||||
},
|
||||
|
||||
fullscreen: function() {
|
||||
this.set('position', PositionEnum.FULLSCREEN);
|
||||
this.trigger('focus');
|
||||
if (this.get('position') !== PositionEnum.HIDDEN) {
|
||||
this.set('position', PositionEnum.FULLSCREEN);
|
||||
this.trigger('focus');
|
||||
}
|
||||
},
|
||||
|
||||
exitFullscreen: function() {
|
||||
this.set('position', PositionEnum.NORMAL);
|
||||
this.trigger('focus');
|
||||
if (this.get('position') === PositionEnum.FULLSCREEN) {
|
||||
this.set('position', PositionEnum.NORMAL);
|
||||
this.trigger('focus');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,9 @@ export default Ember.ObjectController.extend(Ember.Evented, {
|
||||
// Save a reply. This may be called by a composer-reply component that was
|
||||
// set up on a different discussion, so we require a discussion model to
|
||||
// be explicitly passed rather than using the controller's implicit one.
|
||||
saveReply: function(discussion, content) {
|
||||
// @todo break this down into bite-sized functions so that extensions can
|
||||
// easily override where they please.
|
||||
saveReply: function(discussion, data) {
|
||||
var controller = this;
|
||||
var composer = this.get('controllers.composer');
|
||||
var stream = this.get('stream');
|
||||
@@ -26,7 +28,7 @@ export default Ember.ObjectController.extend(Ember.Evented, {
|
||||
controller.get('controllers.application').send('clearAlerts');
|
||||
|
||||
var post = this.store.createRecord('post', {
|
||||
content: content,
|
||||
content: data.content,
|
||||
discussion: discussion
|
||||
});
|
||||
|
||||
@@ -91,12 +93,12 @@ export default Ember.ObjectController.extend(Ember.Evented, {
|
||||
|
||||
// If the composer is already set up for this discussion, then we
|
||||
// don't need to change its content - we can just show it.
|
||||
if (composer.get('content.discussion') != discussion) {
|
||||
if (!(composer.get('content') instanceof ComposerReply) || composer.get('content.discussion') != discussion) {
|
||||
composer.switchContent(ComposerReply.create({
|
||||
user: controller.get('session.user'),
|
||||
discussion: discussion,
|
||||
submit: function(value) {
|
||||
controller.saveReply(discussion, value);
|
||||
submit: function(data) {
|
||||
controller.saveReply(discussion, data);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
Reference in New Issue
Block a user