mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
Convert admin section controllers to ES6 modules
This commit is contained in:
parent
2358d13d49
commit
e242368266
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminApiController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
|
||||
actions: {
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
Discourse.AdminBackupsIndexController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
needs: ["adminBackups"],
|
||||
status: Em.computed.alias("controllers.adminBackups"),
|
||||
|
@ -1,4 +1,4 @@
|
||||
Discourse.AdminBackupsLogsController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
needs: ["adminBackups"],
|
||||
status: Em.computed.alias("controllers.adminBackups")
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
Discourse.AdminBackupsController = Ember.ObjectController.extend({
|
||||
export default Ember.ObjectController.extend({
|
||||
noOperationIsRunning: Em.computed.not("isOperationRunning"),
|
||||
rollbackEnabled: Em.computed.and("canRollback", "restoreEnabled", "noOperationIsRunning"),
|
||||
rollbackDisabled: Em.computed.not("rollbackEnabled")
|
@ -8,7 +8,7 @@
|
||||
@module Discourse
|
||||
**/
|
||||
|
||||
Discourse.AdminBadgeController = Discourse.ObjectController.extend({
|
||||
export default Discourse.ObjectController.extend({
|
||||
/**
|
||||
Whether this badge has been selected.
|
||||
|
@ -6,8 +6,8 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminBadgesController = Ember.ArrayController.extend({
|
||||
itemController: 'adminBadge',
|
||||
export default Ember.ArrayController.extend({
|
||||
itemController: 'admin-badge',
|
||||
queryParams: ['badgeId'],
|
||||
badgeId: Em.computed.alias('selectedId'),
|
||||
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminCustomizeColorsController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
|
||||
onlyOverridden: false,
|
||||
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminCustomizeCssHtmlController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
|
||||
actions: {
|
||||
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminDashboardController = Ember.Controller.extend({
|
||||
export default Ember.Controller.extend({
|
||||
loading: true,
|
||||
versionCheck: null,
|
||||
problemsCheckMinutes: 1,
|
@ -0,0 +1,3 @@
|
||||
import AdminEmailSkippedController from "admin/controllers/admin-email-skipped"
|
||||
|
||||
export default AdminEmailSkippedController.extend({});
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminEmailIndexController = Discourse.Controller.extend({
|
||||
export default Discourse.Controller.extend({
|
||||
|
||||
/**
|
||||
Is the "send test email" button disabled?
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminEmailPreviewDigestController = Discourse.ObjectController.extend({
|
||||
export default Discourse.ObjectController.extend({
|
||||
|
||||
actions: {
|
||||
refresh: function() {
|
@ -0,0 +1,17 @@
|
||||
/**
|
||||
This controller supports email logs functionality.
|
||||
|
||||
@class AdminEmailSentController
|
||||
@extends Discourse.Controller
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default Discourse.Controller.extend({
|
||||
|
||||
filterEmailLogs: Discourse.debounce(function() {
|
||||
var self = this;
|
||||
Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) {
|
||||
self.set("model", logs);
|
||||
});
|
||||
}, 250).observes("filter.user", "filter.address", "filter.type", "filter.reply_key")
|
||||
});
|
@ -0,0 +1,17 @@
|
||||
/**
|
||||
This controller supports email logs functionality.
|
||||
|
||||
@class AdminEmailSkippedController
|
||||
@extends Discourse.Controller
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default Discourse.Controller.extend({
|
||||
|
||||
filterEmailLogs: Discourse.debounce(function() {
|
||||
var self = this;
|
||||
Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) {
|
||||
self.set("model", logs);
|
||||
});
|
||||
}, 250).observes("filter.user", "filter.address", "filter.type", "filter.skipped_reason")
|
||||
});
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminFlagsController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
|
||||
actions: {
|
||||
/**
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminGithubCommitsController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
goToGithub: function() {
|
||||
window.open('https://github.com/discourse/discourse');
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
Discourse.AdminGroupController = Em.ObjectController.extend({
|
||||
export default Em.ObjectController.extend({
|
||||
needs: ['adminGroups'],
|
||||
members: null,
|
||||
disableSave: false,
|
@ -1,4 +1,4 @@
|
||||
Discourse.AdminGroupsController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
sortProperties: ['name'],
|
||||
|
||||
refreshingAutoGroups: false,
|
@ -1,33 +1,4 @@
|
||||
/**
|
||||
This controller supports the interface for listing screened IP addresses in the admin section.
|
||||
|
||||
@class AdminLogsScreenedIpAddressesController
|
||||
@extends Ember.ArrayController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminLogsScreenedIpAddressesController = Ember.ArrayController.extend(Discourse.Presence, {
|
||||
loading: false,
|
||||
content: [],
|
||||
itemController: 'adminLogsScreenedIpAddress',
|
||||
|
||||
show: function() {
|
||||
var self = this;
|
||||
this.set('loading', true);
|
||||
Discourse.ScreenedIpAddress.findAll().then(function(result) {
|
||||
self.set('content', result);
|
||||
self.set('loading', false);
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
recordAdded: function(arg) {
|
||||
this.get("content").unshiftObject(arg);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Discourse.AdminLogsScreenedIpAddressController = Ember.ObjectController.extend({
|
||||
export default Ember.ObjectController.extend({
|
||||
editing: false,
|
||||
savedIpAddress: null,
|
||||
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminLogsScreenedEmailsController = Ember.ArrayController.extend(Discourse.Presence, {
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
loading: false,
|
||||
content: [],
|
||||
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
This controller supports the interface for listing screened IP addresses in the admin section.
|
||||
|
||||
@class AdminLogsScreenedIpAddressesController
|
||||
@extends Ember.ArrayController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
loading: false,
|
||||
content: [],
|
||||
itemController: 'adminLogsScreenedIpAddress',
|
||||
|
||||
show: function() {
|
||||
var self = this;
|
||||
this.set('loading', true);
|
||||
Discourse.ScreenedIpAddress.findAll().then(function(result) {
|
||||
self.set('content', result);
|
||||
self.set('loading', false);
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
recordAdded: function(arg) {
|
||||
this.get("content").unshiftObject(arg);
|
||||
}
|
||||
}
|
||||
});
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminLogsScreenedUrlsController = Ember.ArrayController.extend(Discourse.Presence, {
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
loading: false,
|
||||
content: [],
|
||||
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminLogsStaffActionLogsController = Ember.ArrayController.extend(Discourse.Presence, {
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
loading: false,
|
||||
filters: {},
|
||||
|
@ -1,4 +1,4 @@
|
||||
Discourse.AdminReportsController = Ember.ObjectController.extend({
|
||||
export default Ember.ObjectController.extend({
|
||||
viewMode: 'table',
|
||||
|
||||
viewingTable: Em.computed.equal('viewMode', 'table'),
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminSiteContentEditController = Discourse.Controller.extend({
|
||||
export default Discourse.Controller.extend({
|
||||
|
||||
saveDisabled: function() {
|
||||
if (this.get('saving')) { return true; }
|
||||
@ -24,5 +24,3 @@ Discourse.AdminSiteContentEditController = Discourse.Controller.extend({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Discourse.AdminSiteContentsController = Ember.ArrayController.extend({});
|
@ -0,0 +1 @@
|
||||
export default Ember.ArrayController.extend({});
|
@ -1,4 +1,4 @@
|
||||
Discourse.AdminSiteSettingsCategoryController = Ember.ObjectController.extend({
|
||||
export default Ember.ObjectController.extend({
|
||||
categoryNameKey: null,
|
||||
needs: ['adminSiteSettings'],
|
||||
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.Presence, {
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
filter: null,
|
||||
onlyOverridden: false,
|
||||
filtered: Ember.computed.notEmpty('filter'),
|
@ -7,4 +7,4 @@
|
||||
@uses Discourse.ModalFunctionality
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminStaffActionLogDetailsController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {});
|
||||
export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {});
|
@ -7,7 +7,7 @@
|
||||
@uses Discourse.ModalFunctionality
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminSuspendUserController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||
export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||
|
||||
submitDisabled: function() {
|
||||
return (!this.get('reason') || this.get('reason').length < 1);
|
@ -7,7 +7,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminUserBadgesController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
needs: ["adminUser"],
|
||||
user: Em.computed.alias('controllers.adminUser'),
|
||||
sortProperties: ['granted_at'],
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminUserIndexController = Discourse.ObjectController.extend({
|
||||
export default Discourse.ObjectController.extend({
|
||||
editingTitle: false,
|
||||
originalPrimaryGroupId: null,
|
||||
availableGroups: null,
|
||||
@ -88,4 +88,3 @@ Discourse.AdminUserIndexController = Discourse.ObjectController.extend({
|
||||
}
|
||||
|
||||
});
|
||||
|
10
app/assets/javascripts/admin/controllers/admin-user.js.es6
Normal file
10
app/assets/javascripts/admin/controllers/admin-user.js.es6
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
The top-level controller for user pages in admin.
|
||||
Ember assertion says that this class needs to be defined even if it's empty.
|
||||
|
||||
@class AdminUserController
|
||||
@extends Discourse.ObjectController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default Discourse.ObjectController.extend({});
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Presence, {
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
username: null,
|
||||
query: null,
|
||||
selectAll: false,
|
@ -6,7 +6,7 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminController = Discourse.Controller.extend({
|
||||
export default Discourse.Controller.extend({
|
||||
showBadges: function() {
|
||||
return this.get('currentUser.admin') && Discourse.SiteSettings.enable_badges;
|
||||
}.property()
|
@ -1,38 +0,0 @@
|
||||
/**
|
||||
This controller supports email logs functionality.
|
||||
|
||||
@class AdminEmailSentController
|
||||
@extends Discourse.Controller
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminEmailSentController = Discourse.Controller.extend({
|
||||
|
||||
filterEmailLogs: Discourse.debounce(function() {
|
||||
var self = this;
|
||||
Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) {
|
||||
self.set("model", logs);
|
||||
});
|
||||
}, 250).observes("filter.user", "filter.address", "filter.type", "filter.reply_key")
|
||||
});
|
||||
|
||||
/**
|
||||
This controller supports email logs functionality.
|
||||
|
||||
@class AdminEmailSkippedController
|
||||
@extends Discourse.Controller
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminEmailSkippedController = Discourse.Controller.extend({
|
||||
|
||||
filterEmailLogs: Discourse.debounce(function() {
|
||||
var self = this;
|
||||
Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) {
|
||||
self.set("model", logs);
|
||||
});
|
||||
}, 250).observes("filter.user", "filter.address", "filter.type", "filter.skipped_reason")
|
||||
});
|
||||
|
||||
|
||||
Discourse.AdminEmailAllController = Discourse.AdminEmailSkippedController.extend({});
|
@ -8,7 +8,7 @@
|
||||
@uses Discourse.ModalFunctionality
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.ChangeSiteCustomizationDetailsController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||
export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||
previousSelected: Ember.computed.equal('selectedTab', 'previous'),
|
||||
newSelected: Ember.computed.equal('selectedTab', 'new'),
|
||||
|
@ -8,7 +8,9 @@
|
||||
@uses Discourse.ModalFunctionality
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.DeleteSiteCustomizationDetailsController = Discourse.ChangeSiteCustomizationDetailsController.extend({
|
||||
import ChangeSiteCustomizationDetailsController from "admin/controllers/change-site-customization-details-controller";
|
||||
|
||||
export default ChangeSiteCustomizationDetailsController.extend({
|
||||
onShow: function() {
|
||||
this.selectPrevious();
|
||||
}
|
@ -6,7 +6,8 @@
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminDashboardRoute = Discourse.Route.extend({
|
||||
|
||||
export default Discourse.Route.extend({
|
||||
|
||||
setupController: function(c) {
|
||||
this.fetchDashboardData(c);
|
@ -37,16 +37,20 @@ Discourse.Resolver = Ember.DefaultResolver.extend({
|
||||
normalize: function(fullName) {
|
||||
var split = fullName.split(':');
|
||||
if (split.length > 1) {
|
||||
var discourseBase = 'discourse/' + split[0] + 's/';
|
||||
var adminBase = 'admin/' + split[0] + 's/';
|
||||
|
||||
// Try slashes
|
||||
var dashed = Ember.String.dasherize(split[1].replace(/\./g, '/')),
|
||||
moduleName = 'discourse/' + split[0] + 's/' + dashed;
|
||||
if (requirejs.entries[moduleName]) { return split[0] + ":" + dashed; }
|
||||
var dashed = Ember.String.dasherize(split[1].replace(/\./g, '/'));
|
||||
if (requirejs.entries[discourseBase + dashed] || requirejs.entries[adminBase + dashed]) {
|
||||
return split[0] + ":" + dashed;
|
||||
}
|
||||
|
||||
// Try with dashes instead of slashes
|
||||
dashed = Ember.String.dasherize(split[1].replace(/\./g, '-'));
|
||||
moduleName = 'discourse/' + split[0] + 's/' + dashed;
|
||||
if (requirejs.entries[moduleName]) { return split[0] + ":" + dashed; }
|
||||
if (requirejs.entries[discourseBase + dashed] || requirejs.entries[adminBase + dashed]) {
|
||||
return split[0] + ":" + dashed;
|
||||
}
|
||||
}
|
||||
return this._super(fullName);
|
||||
},
|
||||
|
@ -1,29 +1,29 @@
|
||||
module("Discourse.AdminBadgesController");
|
||||
module("controller:admin-badges");
|
||||
|
||||
test("canEditDescription", function() {
|
||||
var badge, controller;
|
||||
|
||||
badge = Discourse.Badge.create({id: 101, name: "Test Badge"});
|
||||
controller = testController(Discourse.AdminBadgesController, [badge]);
|
||||
controller = testController("admin-badges", [badge]);
|
||||
controller.send('selectBadge', badge);
|
||||
ok(controller.get('canEditDescription'), "allows editing description when a translation exists for the badge name");
|
||||
|
||||
this.stub(I18n, "t").returns("translated string");
|
||||
badge = Discourse.Badge.create({id: 102, name: "Test Badge"});
|
||||
controller = testController(Discourse.AdminBadgesController, [badge]);
|
||||
controller = testController("admin-badges", [badge]);
|
||||
controller.send('selectBadge', badge);
|
||||
ok(!controller.get('canEditDescription'), "shows the displayName when it is different from the name");
|
||||
});
|
||||
|
||||
test("createNewBadge", function() {
|
||||
var controller = testController(Discourse.AdminBadgesController, []);
|
||||
var controller = testController("admin-badges", []);
|
||||
controller.send('createNewBadge');
|
||||
equal(controller.get('model.length'), 1, "adds a new badge to the list of badges");
|
||||
});
|
||||
|
||||
test("selectBadge", function() {
|
||||
var badge = Discourse.Badge.create({id: 101, name: "Test Badge"}),
|
||||
controller = testController(Discourse.AdminBadgesController, [badge]);
|
||||
controller = testController("admin-badges", [badge]);
|
||||
|
||||
controller.send('selectBadge', badge);
|
||||
equal(controller.get('selectedItem'), badge, "the badge is selected");
|
||||
@ -32,7 +32,7 @@ test("selectBadge", function() {
|
||||
test("save", function() {
|
||||
var badge = Discourse.Badge.create({id: 101, name: "Test Badge"}),
|
||||
otherBadge = Discourse.Badge.create({id: 102, name: "Other Badge"}),
|
||||
controller = testController(Discourse.AdminBadgesController, [badge, otherBadge]);
|
||||
controller = testController("admin-badges", [badge, otherBadge]);
|
||||
|
||||
controller.send('selectBadge', badge);
|
||||
this.stub(badge, "save").returns(Ember.RSVP.resolve({}));
|
||||
@ -43,7 +43,7 @@ test("save", function() {
|
||||
test("destroy", function() {
|
||||
var badge = Discourse.Badge.create({id: 101, name: "Test Badge"}),
|
||||
otherBadge = Discourse.Badge.create({id: 102, name: "Other Badge"}),
|
||||
controller = testController(Discourse.AdminBadgesController, [badge, otherBadge]);
|
||||
controller = testController("admin-badges", [badge, otherBadge]);
|
||||
|
||||
this.stub(badge, 'destroy').returns(Ember.RSVP.resolve({}));
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
module("Discourse.AdminEmailIndexController");
|
||||
module("controller:admin-email-index");
|
||||
|
||||
test("mixes in Discourse.Presence", function() {
|
||||
ok(Discourse.Presence.detect(Discourse.AdminEmailIndexController.create()));
|
||||
ok(Discourse.Presence.detect(controllerFor("admin-email-index")));
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
module("Discourse.AdminEmailPreviewDigestController");
|
||||
module("controller:admin-email-preview-digest");
|
||||
|
||||
test("mixes in Discourse.Presence", function() {
|
||||
ok(Discourse.Presence.detect(Discourse.AdminEmailPreviewDigestController.create()));
|
||||
ok(Discourse.Presence.detect(controllerFor("admin-email-preview-digest")));
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
module("Discourse.AdminSiteSettingsController", {
|
||||
module("controller:admin-site-settings", {
|
||||
setup: function() {
|
||||
sinon.stub(Ember.run, "debounce").callsArg(1);
|
||||
},
|
||||
@ -16,7 +16,7 @@ test("filter", function() {
|
||||
nameKey: 'posting', name: 'posting',
|
||||
siteSettings: [Discourse.SiteSetting.create({"setting":"display_name_on_posts","description":"x","default":false,"type":"bool","value":"true","category":"posting"})]
|
||||
})]);
|
||||
var adminSiteSettingsController = testController(Discourse.AdminSiteSettingsController, allSettings);
|
||||
var adminSiteSettingsController = testController("admin-site-settings", allSettings);
|
||||
adminSiteSettingsController.set('allSiteSettings', allSettings);
|
||||
|
||||
equal(adminSiteSettingsController.get('content')[0].nameKey, 'users', "Can get first site setting category's name key.");
|
||||
|
@ -27,8 +27,18 @@ function integration(name, lifecycle) {
|
||||
function testController(klass, model) {
|
||||
// HAX until we get ES6 everywhere:
|
||||
if (typeof klass === "string") {
|
||||
var moduleName = 'discourse/controllers/' + klass,
|
||||
module = requirejs.entries[moduleName];
|
||||
var base = "discourse",
|
||||
moduleName,
|
||||
module;
|
||||
|
||||
// maybe a bit too hacky? (all of the "admin-*" controllers are in the "admin" directory)
|
||||
if (klass.indexOf("admin") == 0) {
|
||||
base = "admin";
|
||||
}
|
||||
|
||||
moduleName = base + '/controllers/' + klass;
|
||||
module = requirejs.entries[moduleName];
|
||||
|
||||
if (module) {
|
||||
klass = require(moduleName, null, null, true).default;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user