Migrate to new Site registration approach
Dieser Commit ist enthalten in:
Ursprung
906db9269f
Commit
9b03552344
3 geänderte Dateien mit 16 neuen und 11 gelöschten Zeilen
|
@ -5,5 +5,3 @@ Wizard.RAW_TEMPLATES = {};
|
|||
Discourse.__widget_helpers = {};
|
||||
Discourse.RAW_TEMPLATES = {};
|
||||
Discourse.SiteSettings = Wizard.SiteSettings;
|
||||
Discourse.Model = Ember.Object.extend();
|
||||
Discourse.Site = Ember.Object.extend();
|
|
@ -31,9 +31,12 @@
|
|||
//= require discourse/lib/key-value-store
|
||||
//= require discourse/lib/settings
|
||||
//= require discourse/lib/user-presence
|
||||
//= require discourse/lib/hash
|
||||
|
||||
//= require discourse/mixins/singleton
|
||||
|
||||
//= require discourse/adapters/rest
|
||||
|
||||
//= require discourse/models/login-method
|
||||
//= require discourse/models/permission-type
|
||||
//= require discourse/models/archetype
|
||||
|
|
|
@ -6,6 +6,7 @@ export default {
|
|||
initialize(app) {
|
||||
if (window.location.pathname.indexOf('/w/') < 0) return;
|
||||
|
||||
const EmberObject = requirejs('@ember/object').default;
|
||||
const Router = requirejs('wizard/router').default;
|
||||
const ApplicationRoute = requirejs('wizard/routes/application').default;
|
||||
const ajax = requirejs('wizard/lib/ajax').ajax;
|
||||
|
@ -22,7 +23,10 @@ export default {
|
|||
const Store = requirejs("discourse/models/store").default;
|
||||
const registerRawHelpers = requirejs("discourse-common/lib/raw-handlebars-helpers").registerRawHelpers;
|
||||
const RawHandlebars = requirejs("discourse-common/lib/raw-handlebars").default;
|
||||
const Site = requirejs("discourse/models/site").default;
|
||||
const RestAdapter = requirejs("discourse/adapters/rest").default;
|
||||
|
||||
Discourse.Model = EmberObject.extend();
|
||||
Discourse.__container__ = app.__container__;
|
||||
Discourse.getURLWithCDN = getUrl;
|
||||
Discourse.getURL = getUrl;
|
||||
|
@ -51,15 +55,15 @@ export default {
|
|||
|
||||
app.register("service:store", Store);
|
||||
targets.forEach(t => app.inject(t, "store", "service:store"));
|
||||
|
||||
const site = Discourse.Site;
|
||||
app.register("site:main", site);
|
||||
targets.forEach(t => app.inject(t, "site", "site:main"));
|
||||
|
||||
targets.forEach(t => app.inject(t, "appEvents", "service:app-events"));
|
||||
|
||||
site.reopenClass(Singleton);
|
||||
site.currentProp('can_create_tag', false);
|
||||
app.register("adapter:rest", RestAdapter);
|
||||
|
||||
const site = Site.current();
|
||||
app.register("site:main", site, { instantiate: false });
|
||||
targets.forEach(t => app.inject(t, "site", "site:main"));
|
||||
|
||||
site.set('can_create_tag', false);
|
||||
|
||||
Router.reopen({
|
||||
rootURL: getUrl('/w/')
|
||||
|
|
Laden …
In neuem Issue referenzieren