mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:32:26 +08:00
Merge pull request #3439 from techAPJ/patch-2
convert open-composer mixin to es6
This commit is contained in:
commit
9e7182474a
|
@ -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')
|
||||
});
|
|
@ -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'),
|
||||
|
||||
|
|
|
@ -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' });
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user