1
0
Fork 0

Require and setup the new Discourse initialization objects

Dieser Commit ist enthalten in:
Angus McLeod 2020-09-01 11:01:46 +10:00
Ursprung dc66bbe936
Commit 48e3c385dc
3 geänderte Dateien mit 15 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -4,8 +4,4 @@ Wizard.SiteSettings = {};
Wizard.RAW_TEMPLATES = {}; Wizard.RAW_TEMPLATES = {};
Discourse.__widget_helpers = {}; Discourse.__widget_helpers = {};
window.__DISCOURSE_RAW_TEMPLATES = {}; window.__DISCOURSE_RAW_TEMPLATES = {};
Discourse.SiteSettings = Wizard.SiteSettings; Discourse.SiteSettings = Wizard.SiteSettings;
define("bootbox", ["exports"], function(__exports__) {
__exports__.default = window.bootbox;
});

Datei anzeigen

@ -124,6 +124,7 @@
//= require caret_position.js //= require caret_position.js
//= require popper.js //= require popper.js
//= require bootbox.js //= require bootbox.js
//= require discourse-shims
//= require ./wizard/custom-wizard //= require ./wizard/custom-wizard
//= require_tree ./wizard/components //= require_tree ./wizard/components

Datei anzeigen

@ -26,10 +26,13 @@ export default {
const RawHandlebars = requirejs("discourse-common/lib/raw-handlebars").default; const RawHandlebars = requirejs("discourse-common/lib/raw-handlebars").default;
const Site = requirejs("discourse/plugins/discourse-custom-wizard/wizard/models/site").default; const Site = requirejs("discourse/plugins/discourse-custom-wizard/wizard/models/site").default;
const RestAdapter = requirejs("discourse/adapters/rest").default; const RestAdapter = requirejs("discourse/adapters/rest").default;
const Session = requirejs("discourse/models/session").default;
const setDefaultOwner = requirejs("discourse-common/lib/get-owner").setDefaultOwner;
const container = app.__container__;
Discourse.Model = EmberObject.extend(); Discourse.Model = EmberObject.extend();
Discourse.__container__ = app.__container__; Discourse.__container__ = container;
setDefaultOwner(container);
registerRawHelpers(RawHandlebars, Handlebars); registerRawHelpers(RawHandlebars, Handlebars);
// IE11 Polyfill - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries#Polyfill // IE11 Polyfill - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries#Polyfill
@ -64,6 +67,14 @@ export default {
targets.forEach(t => app.inject(t, "site", "site:main")); targets.forEach(t => app.inject(t, "site", "site:main"));
site.set('can_create_tag', false); site.set('can_create_tag', false);
let context = {
siteSettings: container.lookup("site-settings:main"),
currentUser: container.lookup("current-user:main"),
site: container.lookup("site:main"),
session: container.lookup("session:main"),
};
createHelperContext(context);
Router.reopen({ Router.reopen({
rootURL: getUrl('/w/') rootURL: getUrl('/w/')