2014-06-09 22:44:29 -06:00
|
|
|
import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
|
2014-06-05 21:18:03 -04:00
|
|
|
import MarkerManager from 'ghost/mixins/marker-manager';
|
|
|
|
|
|
|
|
var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, MarkerManager, {
|
|
|
|
init: function () {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
this._super();
|
|
|
|
|
|
|
|
window.onbeforeunload = function () {
|
|
|
|
return self.get('isDirty') ? self.unloadDirtyMessage() : null;
|
|
|
|
};
|
|
|
|
},
|
2014-06-09 22:44:29 -06:00
|
|
|
|
2014-06-11 15:36:54 -06:00
|
|
|
actions: {
|
|
|
|
/**
|
|
|
|
* Redirect to editor after the first save
|
|
|
|
*/
|
|
|
|
save: function () {
|
|
|
|
var self = this;
|
|
|
|
this._super().then(function (model) {
|
|
|
|
if (model.get('id')) {
|
|
|
|
self.transitionTo('editor.edit', model);
|
|
|
|
}
|
|
|
|
return model;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2014-06-09 22:44:29 -06:00
|
|
|
|
2014-06-05 21:18:03 -04:00
|
|
|
export default EditorNewController;
|