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
|
@ -4,6 +4,4 @@ Wizard.SiteSettings = {};
|
||||||
Wizard.RAW_TEMPLATES = {};
|
Wizard.RAW_TEMPLATES = {};
|
||||||
Discourse.__widget_helpers = {};
|
Discourse.__widget_helpers = {};
|
||||||
Discourse.RAW_TEMPLATES = {};
|
Discourse.RAW_TEMPLATES = {};
|
||||||
Discourse.SiteSettings = Wizard.SiteSettings;
|
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/key-value-store
|
||||||
//= require discourse/lib/settings
|
//= require discourse/lib/settings
|
||||||
//= require discourse/lib/user-presence
|
//= require discourse/lib/user-presence
|
||||||
|
//= require discourse/lib/hash
|
||||||
|
|
||||||
//= require discourse/mixins/singleton
|
//= require discourse/mixins/singleton
|
||||||
|
|
||||||
|
//= require discourse/adapters/rest
|
||||||
|
|
||||||
//= require discourse/models/login-method
|
//= require discourse/models/login-method
|
||||||
//= require discourse/models/permission-type
|
//= require discourse/models/permission-type
|
||||||
//= require discourse/models/archetype
|
//= require discourse/models/archetype
|
||||||
|
|
|
@ -5,7 +5,8 @@ export default {
|
||||||
|
|
||||||
initialize(app) {
|
initialize(app) {
|
||||||
if (window.location.pathname.indexOf('/w/') < 0) return;
|
if (window.location.pathname.indexOf('/w/') < 0) return;
|
||||||
|
|
||||||
|
const EmberObject = requirejs('@ember/object').default;
|
||||||
const Router = requirejs('wizard/router').default;
|
const Router = requirejs('wizard/router').default;
|
||||||
const ApplicationRoute = requirejs('wizard/routes/application').default;
|
const ApplicationRoute = requirejs('wizard/routes/application').default;
|
||||||
const ajax = requirejs('wizard/lib/ajax').ajax;
|
const ajax = requirejs('wizard/lib/ajax').ajax;
|
||||||
|
@ -22,7 +23,10 @@ export default {
|
||||||
const Store = requirejs("discourse/models/store").default;
|
const Store = requirejs("discourse/models/store").default;
|
||||||
const registerRawHelpers = requirejs("discourse-common/lib/raw-handlebars-helpers").registerRawHelpers;
|
const registerRawHelpers = requirejs("discourse-common/lib/raw-handlebars-helpers").registerRawHelpers;
|
||||||
const RawHandlebars = requirejs("discourse-common/lib/raw-handlebars").default;
|
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.__container__ = app.__container__;
|
||||||
Discourse.getURLWithCDN = getUrl;
|
Discourse.getURLWithCDN = getUrl;
|
||||||
Discourse.getURL = getUrl;
|
Discourse.getURL = getUrl;
|
||||||
|
@ -51,16 +55,16 @@ export default {
|
||||||
|
|
||||||
app.register("service:store", Store);
|
app.register("service:store", Store);
|
||||||
targets.forEach(t => app.inject(t, "store", "service: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"));
|
targets.forEach(t => app.inject(t, "appEvents", "service:app-events"));
|
||||||
|
|
||||||
site.reopenClass(Singleton);
|
app.register("adapter:rest", RestAdapter);
|
||||||
site.currentProp('can_create_tag', false);
|
|
||||||
|
|
||||||
|
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({
|
Router.reopen({
|
||||||
rootURL: getUrl('/w/')
|
rootURL: getUrl('/w/')
|
||||||
});
|
});
|
||||||
|
|
Laden …
In neuem Issue referenzieren