diff --git a/app/assets/javascripts/discourse-common/addon/lib/discourse-template-map.js b/app/assets/javascripts/discourse-common/addon/lib/discourse-template-map.js index 51ec2c6c3c3..2a254f54606 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/discourse-template-map.js +++ b/app/assets/javascripts/discourse-common/addon/lib/discourse-template-map.js @@ -8,7 +8,7 @@ function appendToCache(cache, key, value) { cache.set(key, cachedValue); } -const NAMESPACES = ["discourse/", "wizard/", "admin/"]; +const NAMESPACES = ["discourse/", "admin/"]; function isInRecognisedNamespace(moduleName) { for (const ns of NAMESPACES) { diff --git a/app/assets/javascripts/discourse-common/addon/lib/loader-shim.js b/app/assets/javascripts/discourse-common/addon/lib/loader-shim.js index 6fe66c42deb..f0368c42fa8 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/loader-shim.js +++ b/app/assets/javascripts/discourse-common/addon/lib/loader-shim.js @@ -16,7 +16,7 @@ let { define: __define__, require: __require__ } = globalThis; // it appears to be unused in the static analysis. // // For Discourse, the AMD/loader.js mechanism is an important glue. It is what -// allows Discourse core/admin/wizard/plugins to all be separate .js bundlers +// allows Discourse core/admin/plugins to all be separate .js bundlers // and be "glued back together" as full module graph in the browser. // // For instance, a plugin module can `import Post from "discourse/models/post"; diff --git a/app/assets/javascripts/discourse-common/addon/resolver.js b/app/assets/javascripts/discourse-common/addon/resolver.js index 651e48be51f..9db4d96d80c 100644 --- a/app/assets/javascripts/discourse-common/addon/resolver.js +++ b/app/assets/javascripts/discourse-common/addon/resolver.js @@ -135,7 +135,6 @@ function lookupModuleBySuffix(suffix) { "discourse-common/", "select-kit/", "admin/", - "wizard/", "truth-helpers/", ]; Object.keys(requirejs.entries).forEach((name) => { @@ -215,18 +214,12 @@ export function buildResolver(baseName) { const dashed = dasherize(split[1].replace(/[\.\/]/g, "-")); const adminBase = `admin/${type}s/`; - const wizardBase = `wizard/${type}s/`; if ( lookupModuleBySuffix(`${type}s/${dashed}`) || requirejs.entries[adminBase + dashed] || requirejs.entries[adminBase + dashed.replace(/^admin[-]/, "")] || requirejs.entries[ adminBase + dashed.replace(/^admin[-]/, "").replace(/-/g, "_") - ] || - requirejs.entries[wizardBase + dashed] || - requirejs.entries[wizardBase + dashed.replace(/^wizard[-]/, "")] || - requirejs.entries[ - wizardBase + dashed.replace(/^wizard[-]/, "").replace(/-/g, "_") ] ) { corrected = type + ":" + dashed; @@ -282,7 +275,6 @@ export function buildResolver(baseName) { this.findMobileTemplate(parsedName) || this.findTemplate(parsedName) || this.findAdminTemplate(parsedName) || - this.findWizardTemplate(parsedName) || this.findLoadingTemplate(parsedName) || this.findConnectorTemplate(parsedName) || this.discourseTemplateModule("not_found") @@ -386,28 +378,5 @@ export function buildResolver(baseName) { return resolved; } - - findWizardTemplate(parsedName) { - if (parsedName.fullNameWithoutType === "wizard") { - return this.discourseTemplateModule("wizard/templates/wizard"); - } - - let namespaced; - - if (parsedName.fullNameWithoutType.startsWith("components/")) { - // Look up components as-is - namespaced = parsedName.fullNameWithoutType; - } else if (/^wizard[_\.-]/.test(parsedName.fullNameWithoutType)) { - // This may only get hit for the loading routes and may be removable. - namespaced = parsedName.fullNameWithoutType.slice(7); - } - - if (namespaced) { - let wizardParsedName = this.parseName( - `template:wizard/templates/${namespaced}` - ); - return this.findTemplate(wizardParsedName); - } - } }; } diff --git a/app/assets/javascripts/discourse/app/mapping-router.js b/app/assets/javascripts/discourse/app/mapping-router.js index 6844a751554..a64d1de642e 100644 --- a/app/assets/javascripts/discourse/app/mapping-router.js +++ b/app/assets/javascripts/discourse/app/mapping-router.js @@ -1,10 +1,10 @@ -import EmberRouter from "@ember/routing/router"; +import EmbroiderRouter from "@embroider/router"; import Site from "discourse/models/site"; import { isTesting } from "discourse-common/config/environment"; import getURL from "discourse-common/lib/get-url"; import applyRouterHomepageOverrides from "./lib/homepage-router-overrides"; -class BareRouter extends EmberRouter { +class BareRouter extends EmbroiderRouter { location = isTesting() ? "none" : "history"; setupRouter() { diff --git a/app/assets/javascripts/discourse/app/routes/app-route-map.js b/app/assets/javascripts/discourse/app/routes/app-route-map.js index 96a9017994f..51b5c29f6b3 100644 --- a/app/assets/javascripts/discourse/app/routes/app-route-map.js +++ b/app/assets/javascripts/discourse/app/routes/app-route-map.js @@ -276,4 +276,8 @@ export default function () { this.route("invites", { resetNamespace: true }, function () { this.route("show", { path: "/:token" }); }); + + this.route("wizard", function () { + this.route("step", { path: "/steps/:step_id" }); + }); } diff --git a/app/assets/javascripts/wizard/addon/routes/wizard.js b/app/assets/javascripts/discourse/app/routes/wizard.js similarity index 91% rename from app/assets/javascripts/wizard/addon/routes/wizard.js rename to app/assets/javascripts/discourse/app/routes/wizard.js index c78c766adb5..f32f0409a34 100644 --- a/app/assets/javascripts/wizard/addon/routes/wizard.js +++ b/app/assets/javascripts/discourse/app/routes/wizard.js @@ -1,6 +1,6 @@ import Route from "@ember/routing/route"; import DisableSidebar from "discourse/mixins/disable-sidebar"; -import Wizard from "wizard/models/wizard"; +import Wizard from "discourse/static/wizard/models/wizard"; export default class WizardRoute extends Route.extend(DisableSidebar) { model() { diff --git a/app/assets/javascripts/wizard/addon/routes/wizard-index.js b/app/assets/javascripts/discourse/app/routes/wizard/index.js similarity index 100% rename from app/assets/javascripts/wizard/addon/routes/wizard-index.js rename to app/assets/javascripts/discourse/app/routes/wizard/index.js diff --git a/app/assets/javascripts/wizard/addon/routes/wizard-step.js b/app/assets/javascripts/discourse/app/routes/wizard/step.js similarity index 100% rename from app/assets/javascripts/wizard/addon/routes/wizard-step.js rename to app/assets/javascripts/discourse/app/routes/wizard/step.js diff --git a/app/assets/javascripts/wizard/addon/components/discourse-logo.gjs b/app/assets/javascripts/discourse/app/static/wizard/components/discourse-logo.gjs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/discourse-logo.gjs rename to app/assets/javascripts/discourse/app/static/wizard/components/discourse-logo.gjs diff --git a/app/assets/javascripts/wizard/addon/components/fields/checkbox.hbs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/checkbox.hbs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/checkbox.hbs rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/checkbox.hbs diff --git a/app/assets/javascripts/wizard/addon/components/fields/checkbox.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/checkbox.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/checkbox.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/checkbox.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/checkboxes.hbs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/checkboxes.hbs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/checkboxes.hbs rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/checkboxes.hbs diff --git a/app/assets/javascripts/wizard/addon/components/fields/checkboxes.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/checkboxes.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/checkboxes.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/checkboxes.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/dropdown.hbs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/dropdown.hbs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/dropdown.hbs rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/dropdown.hbs diff --git a/app/assets/javascripts/wizard/addon/components/fields/dropdown.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/dropdown.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/dropdown.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/dropdown.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/image-previews/generic.hbs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/generic.hbs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/image-previews/generic.hbs rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/generic.hbs diff --git a/app/assets/javascripts/wizard/addon/components/fields/image-previews/generic.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/generic.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/image-previews/generic.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/generic.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/image-previews/index.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/index.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/image-previews/index.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/index.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/image-previews/logo-small.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/logo-small.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/image-previews/logo-small.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/logo-small.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/image-previews/logo.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/logo.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/image-previews/logo.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/image-previews/logo.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/image.hbs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/image.hbs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/image.hbs rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/image.hbs diff --git a/app/assets/javascripts/wizard/addon/components/fields/image.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/image.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/image.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/image.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/index.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/index.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/index.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/index.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/styling-preview/-homepage-preview.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/-homepage-preview.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/styling-preview/-homepage-preview.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/-homepage-preview.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/styling-preview/-preview-base.hbs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/-preview-base.hbs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/styling-preview/-preview-base.hbs rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/-preview-base.hbs diff --git a/app/assets/javascripts/wizard/addon/components/fields/styling-preview/-preview-base.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/-preview-base.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/styling-preview/-preview-base.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/-preview-base.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/styling-preview/index.hbs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/index.hbs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/styling-preview/index.hbs rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/index.hbs diff --git a/app/assets/javascripts/wizard/addon/components/fields/styling-preview/index.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/index.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/styling-preview/index.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/styling-preview/index.js diff --git a/app/assets/javascripts/wizard/addon/components/fields/text.hbs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/text.hbs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/text.hbs rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/text.hbs diff --git a/app/assets/javascripts/wizard/addon/components/fields/text.js b/app/assets/javascripts/discourse/app/static/wizard/components/fields/text.js similarity index 100% rename from app/assets/javascripts/wizard/addon/components/fields/text.js rename to app/assets/javascripts/discourse/app/static/wizard/components/fields/text.js diff --git a/app/assets/javascripts/wizard/addon/components/wizard-canvas.gjs b/app/assets/javascripts/discourse/app/static/wizard/components/wizard-canvas.gjs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/wizard-canvas.gjs rename to app/assets/javascripts/discourse/app/static/wizard/components/wizard-canvas.gjs diff --git a/app/assets/javascripts/wizard/addon/components/wizard-field.gjs b/app/assets/javascripts/discourse/app/static/wizard/components/wizard-field.gjs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/wizard-field.gjs rename to app/assets/javascripts/discourse/app/static/wizard/components/wizard-field.gjs diff --git a/app/assets/javascripts/wizard/addon/components/wizard-step.gjs b/app/assets/javascripts/discourse/app/static/wizard/components/wizard-step.gjs similarity index 100% rename from app/assets/javascripts/wizard/addon/components/wizard-step.gjs rename to app/assets/javascripts/discourse/app/static/wizard/components/wizard-step.gjs diff --git a/app/assets/javascripts/wizard/addon/lib/preview.js b/app/assets/javascripts/discourse/app/static/wizard/lib/preview.js similarity index 100% rename from app/assets/javascripts/wizard/addon/lib/preview.js rename to app/assets/javascripts/discourse/app/static/wizard/lib/preview.js diff --git a/app/assets/javascripts/wizard/addon/models/wizard.js b/app/assets/javascripts/discourse/app/static/wizard/models/wizard.js similarity index 100% rename from app/assets/javascripts/wizard/addon/models/wizard.js rename to app/assets/javascripts/discourse/app/static/wizard/models/wizard.js diff --git a/app/assets/javascripts/wizard/addon/templates/wizard.gjs b/app/assets/javascripts/discourse/app/templates/wizard.gjs similarity index 78% rename from app/assets/javascripts/wizard/addon/templates/wizard.gjs rename to app/assets/javascripts/discourse/app/templates/wizard.gjs index 1b35aa10bc2..80dc4d944f4 100644 --- a/app/assets/javascripts/wizard/addon/templates/wizard.gjs +++ b/app/assets/javascripts/discourse/app/templates/wizard.gjs @@ -1,6 +1,6 @@ import RouteTemplate from "ember-route-template"; import hideApplicationFooter from "discourse/helpers/hide-application-footer"; -import DiscourseLogo from "../components/discourse-logo"; +import DiscourseLogo from "discourse/static/wizard/components/discourse-logo"; export default RouteTemplate(