diff --git a/app/assets/javascripts/discourse/mixins/open_composer.js b/app/assets/javascripts/discourse/mixins/open-composer.js.es6 similarity index 51% rename from app/assets/javascripts/discourse/mixins/open_composer.js rename to app/assets/javascripts/discourse/mixins/open-composer.js.es6 index 8e1906ba9..03516b9d8 100644 --- a/app/assets/javascripts/discourse/mixins/open_composer.js +++ b/app/assets/javascripts/discourse/mixins/open-composer.js.es6 @@ -1,14 +1,8 @@ -/** - This mixin allows a route to open the composer +// This mixin allows a route to open the composer - @class Discourse.OpenComposer - @extends Ember.Mixin - @namespace Discourse - @module Discourse -**/ -Discourse.OpenComposer = Em.Mixin.create({ +export default Ember.Mixin.create({ - openComposer: function(controller) { + openComposer(controller) { this.controllerFor('composer').open({ categoryId: controller.get('category.id'), action: Discourse.Composer.CREATE_TOPIC, @@ -17,13 +11,13 @@ Discourse.OpenComposer = Em.Mixin.create({ }); }, - openComposerWithParams: function(controller, title, body, category_id, category) { + openComposerWithParams(controller, topicTitle, topicBody, topicCategoryId, topicCategory) { this.controllerFor('composer').open({ action: Discourse.Composer.CREATE_TOPIC, - topicTitle: title, - topicBody: body, - topicCategoryId: category_id, - topicCategory: category, + topicTitle, + topicBody, + topicCategoryId, + topicCategory, draftKey: controller.get('draft_key'), draftSequence: controller.get('draft_sequence') }); diff --git a/app/assets/javascripts/discourse/routes/application.js.es6 b/app/assets/javascripts/discourse/routes/application.js.es6 index 22f97dc2c..17d5d824e 100644 --- a/app/assets/javascripts/discourse/routes/application.js.es6 +++ b/app/assets/javascripts/discourse/routes/application.js.es6 @@ -1,4 +1,5 @@ import showModal from 'discourse/lib/show-modal'; +import OpenComposer from "discourse/mixins/open-composer"; function unlessReadOnly(method) { return function() { @@ -10,7 +11,7 @@ function unlessReadOnly(method) { }; } -const ApplicationRoute = Discourse.Route.extend(Discourse.OpenComposer, { +const ApplicationRoute = Discourse.Route.extend(OpenComposer, { siteTitle: Discourse.computed.setting('title'), diff --git a/app/assets/javascripts/discourse/routes/discovery-categories-route.js.es6 b/app/assets/javascripts/discourse/routes/discovery-categories-route.js.es6 index 636a646db..c46b9b827 100644 --- a/app/assets/javascripts/discourse/routes/discovery-categories-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/discovery-categories-route.js.es6 @@ -1,7 +1,8 @@ import ShowFooter from 'discourse/mixins/show-footer'; import showModal from 'discourse/lib/show-modal'; +import OpenComposer from "discourse/mixins/open-composer"; -Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenComposer, ShowFooter, { +Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, ShowFooter, { renderTemplate() { this.render('navigation/categories', { outlet: 'navigation-bar' }); this.render('discovery/categories', { outlet: 'list-container' }); diff --git a/app/assets/javascripts/discourse/routes/discovery.js.es6 b/app/assets/javascripts/discourse/routes/discovery.js.es6 index c12cb9a72..572b9536b 100644 --- a/app/assets/javascripts/discourse/routes/discovery.js.es6 +++ b/app/assets/javascripts/discourse/routes/discovery.js.es6 @@ -4,8 +4,9 @@ **/ import ShowFooter from "discourse/mixins/show-footer"; +import OpenComposer from "discourse/mixins/open-composer"; -const DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse.OpenComposer, ShowFooter, { +const DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, OpenComposer, ShowFooter, { redirect: function() { return this.redirectIfLoginRequired(); }, beforeModel: function(transition) {