mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Merge pull request #3439 from techAPJ/patch-2
convert open-composer mixin to es6
This commit is contained in:
commit
9e7182474a
4 changed files with 14 additions and 17 deletions
|
@ -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
|
export default Ember.Mixin.create({
|
||||||
@extends Ember.Mixin
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
Discourse.OpenComposer = Em.Mixin.create({
|
|
||||||
|
|
||||||
openComposer: function(controller) {
|
openComposer(controller) {
|
||||||
this.controllerFor('composer').open({
|
this.controllerFor('composer').open({
|
||||||
categoryId: controller.get('category.id'),
|
categoryId: controller.get('category.id'),
|
||||||
action: Discourse.Composer.CREATE_TOPIC,
|
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({
|
this.controllerFor('composer').open({
|
||||||
action: Discourse.Composer.CREATE_TOPIC,
|
action: Discourse.Composer.CREATE_TOPIC,
|
||||||
topicTitle: title,
|
topicTitle,
|
||||||
topicBody: body,
|
topicBody,
|
||||||
topicCategoryId: category_id,
|
topicCategoryId,
|
||||||
topicCategory: category,
|
topicCategory,
|
||||||
draftKey: controller.get('draft_key'),
|
draftKey: controller.get('draft_key'),
|
||||||
draftSequence: controller.get('draft_sequence')
|
draftSequence: controller.get('draft_sequence')
|
||||||
});
|
});
|
|
@ -1,4 +1,5 @@
|
||||||
import showModal from 'discourse/lib/show-modal';
|
import showModal from 'discourse/lib/show-modal';
|
||||||
|
import OpenComposer from "discourse/mixins/open-composer";
|
||||||
|
|
||||||
function unlessReadOnly(method) {
|
function unlessReadOnly(method) {
|
||||||
return function() {
|
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'),
|
siteTitle: Discourse.computed.setting('title'),
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import ShowFooter from 'discourse/mixins/show-footer';
|
import ShowFooter from 'discourse/mixins/show-footer';
|
||||||
import showModal from 'discourse/lib/show-modal';
|
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() {
|
renderTemplate() {
|
||||||
this.render('navigation/categories', { outlet: 'navigation-bar' });
|
this.render('navigation/categories', { outlet: 'navigation-bar' });
|
||||||
this.render('discovery/categories', { outlet: 'list-container' });
|
this.render('discovery/categories', { outlet: 'list-container' });
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
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(); },
|
redirect: function() { return this.redirectIfLoginRequired(); },
|
||||||
|
|
||||||
beforeModel: function(transition) {
|
beforeModel: function(transition) {
|
||||||
|
|
Loading…
Reference in a new issue