Autoload widgets since they are named when created, not by file
This commit is contained in:
parent
b83b9d2b75
commit
fbf45426e4
|
@ -0,0 +1,15 @@
|
|||
export function autoLoadModules() {
|
||||
Ember.keys(requirejs.entries).forEach(entry => {
|
||||
if ((/\/helpers\//).test(entry)) {
|
||||
require(entry, null, null, true);
|
||||
}
|
||||
if ((/\/widgets\//).test(entry)) {
|
||||
require(entry, null, null, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'auto-load-modules',
|
||||
initialize: autoLoadModules
|
||||
};
|
|
@ -1,12 +0,0 @@
|
|||
export function loadAllHelpers() {
|
||||
Ember.keys(requirejs.entries).forEach(entry => {
|
||||
if ((/\/helpers\//).test(entry)) {
|
||||
require(entry, null, null, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'load-all-helpers',
|
||||
initialize: loadAllHelpers
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
import AppEvents from 'discourse/lib/app-events';
|
||||
import createStore from 'helpers/create-store';
|
||||
import { loadAllHelpers } from 'discourse/initializers/load-all-helpers';
|
||||
import { autoLoadModules } from 'discourse/initializers/auto-load-modules';
|
||||
|
||||
export default function(name, opts) {
|
||||
opts = opts || {};
|
||||
|
@ -18,7 +18,7 @@ export default function(name, opts) {
|
|||
|
||||
this.siteSettings = Discourse.SiteSettings;
|
||||
|
||||
loadAllHelpers();
|
||||
autoLoadModules();
|
||||
|
||||
if (opts.setup) {
|
||||
const store = createStore();
|
||||
|
|
Loading…
Reference in New Issue