2022-07-06 21:20:00 +08:00
|
|
|
/* global Ember */
|
|
|
|
import { dasherize, decamelize } from "@ember/string";
|
2019-10-04 22:06:08 +08:00
|
|
|
import deprecated from "discourse-common/lib/deprecated";
|
2016-10-25 01:49:17 +08:00
|
|
|
import { findHelper } from "discourse-common/lib/helpers";
|
2021-11-19 00:38:00 +08:00
|
|
|
import SuffixTrie from "discourse-common/lib/suffix-trie";
|
2022-07-06 21:20:00 +08:00
|
|
|
import Resolver from "ember-resolver";
|
|
|
|
import { buildResolver as buildLegacyResolver } from "discourse-common/lib/legacy-resolver";
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2021-03-10 21:27:42 +08:00
|
|
|
let _options = {};
|
2021-11-19 00:38:00 +08:00
|
|
|
let moduleSuffixTrie = null;
|
2016-11-04 02:15:26 +08:00
|
|
|
|
2022-08-03 00:05:02 +08:00
|
|
|
const DEPRECATED_MODULES = new Map(
|
|
|
|
Object.entries({
|
|
|
|
"controller:discovery.categoryWithID": {
|
|
|
|
newName: "controller:discovery.category",
|
|
|
|
since: "2.6.0",
|
|
|
|
},
|
|
|
|
"controller:discovery.parentCategory": {
|
|
|
|
newName: "controller:discovery.category",
|
|
|
|
since: "2.6.0",
|
|
|
|
},
|
|
|
|
"controller:tags-show": { newName: "controller:tag-show", since: "2.6.0" },
|
|
|
|
"controller:tags.show": { newName: "controller:tag.show", since: "2.6.0" },
|
|
|
|
"controller:tagsShow": { newName: "controller:tagShow", since: "2.6.0" },
|
|
|
|
"route:discovery.categoryWithID": {
|
|
|
|
newName: "route:discovery.category",
|
|
|
|
since: "2.6.0",
|
|
|
|
},
|
|
|
|
"route:discovery.parentCategory": {
|
|
|
|
newName: "route:discovery.category",
|
|
|
|
since: "2.6.0",
|
|
|
|
},
|
|
|
|
"route:tags-show": { newName: "route:tag-show", since: "2.6.0" },
|
|
|
|
"route:tags.show": { newName: "route:tag.show", since: "2.6.0" },
|
|
|
|
"route:tagsShow": { newName: "route:tagShow", since: "2.6.0" },
|
|
|
|
"app-events:main": {
|
|
|
|
newName: "service:app-events",
|
|
|
|
since: "2.4.0",
|
|
|
|
dropFrom: "2.9.0.beta1",
|
|
|
|
},
|
2022-08-15 23:11:46 +08:00
|
|
|
// Deprecations below are silenced because they're in widespread use, and upgrading
|
|
|
|
// themes/plugins right now would break their compatibility with the stable branch.
|
|
|
|
// These should be unsilenced for the release of 2.9.0 stable.
|
2022-08-03 00:05:02 +08:00
|
|
|
"store:main": {
|
|
|
|
newName: "service:store",
|
|
|
|
since: "2.8.0.beta8",
|
|
|
|
dropFrom: "2.9.0.beta1",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-03 00:05:02 +08:00
|
|
|
},
|
|
|
|
"search-service:main": {
|
|
|
|
newName: "service:search",
|
|
|
|
since: "2.8.0.beta8",
|
|
|
|
dropFrom: "2.9.0.beta1",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-03 00:05:02 +08:00
|
|
|
},
|
|
|
|
"key-value-store:main": {
|
|
|
|
newName: "service:key-value-store",
|
|
|
|
since: "2.9.0.beta7",
|
|
|
|
dropFrom: "3.0.0",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-03 00:05:02 +08:00
|
|
|
},
|
|
|
|
"pm-topic-tracking-state:main": {
|
|
|
|
newName: "service:pm-topic-tracking-state",
|
|
|
|
since: "2.9.0.beta7",
|
|
|
|
dropFrom: "3.0.0",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-03 00:05:02 +08:00
|
|
|
},
|
|
|
|
"message-bus:main": {
|
|
|
|
newName: "service:message-bus",
|
|
|
|
since: "2.9.0.beta7",
|
|
|
|
dropFrom: "3.0.0",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-03 00:05:02 +08:00
|
|
|
},
|
|
|
|
"site-settings:main": {
|
|
|
|
newName: "service:site-settings",
|
|
|
|
since: "2.9.0.beta7",
|
|
|
|
dropFrom: "3.0.0",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-03 00:05:02 +08:00
|
|
|
},
|
2022-07-31 01:15:43 +08:00
|
|
|
"current-user:main": {
|
|
|
|
newName: "service:current-user",
|
|
|
|
since: "2.9.0.beta7",
|
|
|
|
dropFrom: "3.0.0",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-07-31 01:15:43 +08:00
|
|
|
},
|
2022-08-03 06:55:20 +08:00
|
|
|
"session:main": {
|
|
|
|
newName: "service:session",
|
|
|
|
since: "2.9.0.beta7",
|
2022-08-03 21:38:35 +08:00
|
|
|
dropFrom: "3.0.0",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-03 21:38:35 +08:00
|
|
|
},
|
|
|
|
"site:main": {
|
|
|
|
newName: "service:site",
|
|
|
|
since: "2.9.0.beta7",
|
2022-08-05 08:48:55 +08:00
|
|
|
dropFrom: "3.0.0",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-05 08:48:55 +08:00
|
|
|
},
|
|
|
|
"topic-tracking-state:main": {
|
|
|
|
newName: "service:topic-tracking-state",
|
|
|
|
since: "2.9.0.beta7",
|
2022-08-03 06:55:20 +08:00
|
|
|
dropFrom: "3.0.0",
|
2022-08-15 23:11:46 +08:00
|
|
|
silent: true,
|
2022-08-03 06:55:20 +08:00
|
|
|
},
|
2022-08-03 00:05:02 +08:00
|
|
|
})
|
|
|
|
);
|
|
|
|
|
2016-11-04 02:15:26 +08:00
|
|
|
export function setResolverOption(name, value) {
|
|
|
|
_options[name] = value;
|
|
|
|
}
|
|
|
|
|
2016-12-20 00:19:10 +08:00
|
|
|
export function getResolverOption(name) {
|
|
|
|
return _options[name];
|
|
|
|
}
|
|
|
|
|
2021-03-10 21:27:42 +08:00
|
|
|
export function clearResolverOptions() {
|
|
|
|
_options = {};
|
|
|
|
}
|
|
|
|
|
2021-11-19 00:38:00 +08:00
|
|
|
function lookupModuleBySuffix(suffix) {
|
|
|
|
if (!moduleSuffixTrie) {
|
|
|
|
moduleSuffixTrie = new SuffixTrie("/");
|
2022-10-17 16:33:52 +08:00
|
|
|
const searchPaths = [
|
|
|
|
"discourse/", // Includes themes/plugins
|
|
|
|
"discourse-common/",
|
|
|
|
"select-kit/",
|
|
|
|
"admin/",
|
|
|
|
"wizard/",
|
|
|
|
"truth-helpers/",
|
|
|
|
];
|
2021-11-19 00:38:00 +08:00
|
|
|
Object.keys(requirejs.entries).forEach((name) => {
|
2022-10-17 16:33:52 +08:00
|
|
|
if (
|
|
|
|
searchPaths.some((s) => name.startsWith(s)) &&
|
|
|
|
!name.includes("/templates/")
|
|
|
|
) {
|
2021-11-19 00:38:00 +08:00
|
|
|
moduleSuffixTrie.add(name);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return moduleSuffixTrie.withSuffix(suffix, 1)[0];
|
|
|
|
}
|
|
|
|
|
2016-08-31 23:30:51 +08:00
|
|
|
export function buildResolver(baseName) {
|
2022-07-06 21:20:00 +08:00
|
|
|
let LegacyResolver = buildLegacyResolver(baseName);
|
|
|
|
|
|
|
|
return class extends Resolver {
|
|
|
|
LegacyResolver = LegacyResolver;
|
|
|
|
|
|
|
|
init(props) {
|
|
|
|
super.init(props);
|
|
|
|
this.legacyResolver = this.LegacyResolver.create(props);
|
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
resolveRouter(/* parsedName */) {
|
2016-08-31 23:30:51 +08:00
|
|
|
const routerPath = `${baseName}/router`;
|
|
|
|
if (requirejs.entries[routerPath]) {
|
2017-07-06 02:14:30 +08:00
|
|
|
const module = requirejs(routerPath, null, null, true);
|
2016-08-31 23:30:51 +08:00
|
|
|
return module.default;
|
|
|
|
}
|
2022-07-06 21:20:00 +08:00
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
// We overwrite this instead of `normalize` so we still get the benefits of the cache.
|
|
|
|
_normalize(fullName) {
|
2022-08-03 00:05:02 +08:00
|
|
|
const deprecationInfo = DEPRECATED_MODULES.get(fullName);
|
|
|
|
if (deprecationInfo) {
|
2022-08-15 23:11:46 +08:00
|
|
|
if (!deprecationInfo.silent) {
|
|
|
|
deprecated(
|
|
|
|
`"${fullName}" is deprecated, use "${deprecationInfo.newName}" instead`,
|
|
|
|
{
|
|
|
|
since: deprecationInfo.since,
|
|
|
|
dropFrom: deprecationInfo.dropFrom,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2022-08-03 00:05:02 +08:00
|
|
|
fullName = deprecationInfo.newName;
|
2020-11-03 22:57:58 +08:00
|
|
|
}
|
|
|
|
|
2022-07-07 19:42:23 +08:00
|
|
|
const split = fullName.split(":");
|
|
|
|
const type = split[0];
|
|
|
|
|
|
|
|
let normalized;
|
|
|
|
if (type === "template" && split[1]?.includes("connectors/")) {
|
|
|
|
// The default normalize implementation will skip dasherizing component template names
|
|
|
|
// We need the same for our connector templates names
|
|
|
|
normalized = "template:" + split[1].replace(/_/g, "-");
|
|
|
|
} else {
|
|
|
|
normalized = super._normalize(fullName);
|
|
|
|
}
|
2022-07-06 21:20:00 +08:00
|
|
|
|
|
|
|
// This is code that we don't really want to keep long term. The main situation where we need it is for
|
|
|
|
// doing stuff like `controllerFor('adminWatchedWordsAction')` where the real route name
|
|
|
|
// is actually `adminWatchedWords.action`. The default behavior for the former is to
|
|
|
|
// normalize to `adminWatchedWordsAction` where the latter becomes `adminWatchedWords.action`.
|
|
|
|
// While these end up looking up the same file ultimately, they are treated as different
|
|
|
|
// items and so we can end up with two distinct version of the controller!
|
|
|
|
if (
|
|
|
|
split.length > 1 &&
|
|
|
|
(type === "controller" || type === "route" || type === "template")
|
|
|
|
) {
|
|
|
|
let corrected;
|
|
|
|
// This should only apply when there's a dot or slash in the name
|
|
|
|
if (split[1].includes(".") || split[1].includes("/")) {
|
|
|
|
// Check to see if the dasherized version exists. If it does we want to
|
|
|
|
// normalize to that eagerly so the normalized versions of the dotted/slashed and
|
|
|
|
// dotless/slashless match.
|
|
|
|
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;
|
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
}
|
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
if (corrected && corrected !== normalized) {
|
|
|
|
normalized = corrected;
|
2016-08-31 23:30:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
return normalized;
|
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
chooseModuleName(moduleName, parsedName) {
|
|
|
|
let resolved = super.chooseModuleName(moduleName, parsedName);
|
|
|
|
if (resolved) {
|
|
|
|
return resolved;
|
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
const standard = parsedName.fullNameWithoutType;
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
let variants = [standard];
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
if (standard.includes("/")) {
|
|
|
|
variants.push(parsedName.fullNameWithoutType.replace(/\//g, "-"));
|
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
for (let name of variants) {
|
|
|
|
// If we end with the name we want, use it. This allows us to define components within plugins.
|
|
|
|
const suffix = parsedName.type + "s/" + name;
|
|
|
|
resolved = lookupModuleBySuffix(dasherize(suffix));
|
|
|
|
if (resolved) {
|
|
|
|
return resolved;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
resolveOther(parsedName) {
|
|
|
|
let resolved = super.resolveOther(parsedName);
|
|
|
|
if (!resolved) {
|
|
|
|
let legacyParsedName = this.legacyResolver.parseName(
|
|
|
|
`${parsedName.type}:${parsedName.fullName}`
|
|
|
|
);
|
|
|
|
resolved = this.legacyResolver.resolveOther(legacyParsedName);
|
|
|
|
if (resolved) {
|
|
|
|
deprecated(
|
|
|
|
`Unable to resolve with new resolver, but resolved with legacy resolver: ${parsedName.fullName}`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resolved;
|
|
|
|
}
|
2016-10-20 05:12:25 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
resolveHelper(parsedName) {
|
|
|
|
return findHelper(parsedName.fullNameWithoutType);
|
|
|
|
}
|
2022-01-06 06:22:13 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
// If no match is found here, the resolver falls back to `resolveOther`.
|
2016-08-31 23:30:51 +08:00
|
|
|
resolveRoute(parsedName) {
|
2019-11-09 04:18:13 +08:00
|
|
|
if (parsedName.fullNameWithoutType === "basic") {
|
|
|
|
return requirejs("discourse/routes/discourse", null, null, true)
|
|
|
|
.default;
|
|
|
|
}
|
2022-07-06 21:20:00 +08:00
|
|
|
}
|
2016-12-20 00:19:10 +08:00
|
|
|
|
2016-08-31 23:30:51 +08:00
|
|
|
resolveTemplate(parsedName) {
|
|
|
|
return (
|
|
|
|
this.findPluginMobileTemplate(parsedName) ||
|
|
|
|
this.findPluginTemplate(parsedName) ||
|
|
|
|
this.findMobileTemplate(parsedName) ||
|
|
|
|
this.findTemplate(parsedName) ||
|
2022-07-06 21:20:00 +08:00
|
|
|
this.findAdminTemplate(parsedName) ||
|
|
|
|
this.findWizardTemplate(parsedName) ||
|
2016-11-12 05:31:08 +08:00
|
|
|
this.findLoadingTemplate(parsedName) ||
|
2016-12-20 00:19:10 +08:00
|
|
|
this.findConnectorTemplate(parsedName) ||
|
2016-08-31 23:30:51 +08:00
|
|
|
Ember.TEMPLATES.not_found
|
|
|
|
);
|
2022-07-06 21:20:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
findLoadingTemplate(parsedName) {
|
|
|
|
if (parsedName.fullNameWithoutType.match(/loading$/)) {
|
|
|
|
return Ember.TEMPLATES.loading;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
findConnectorTemplate(parsedName) {
|
|
|
|
if (parsedName.fullName.startsWith("template:connectors/")) {
|
|
|
|
const connectorParsedName = this.parseName(
|
|
|
|
parsedName.fullName
|
|
|
|
.replace("template:connectors/", "template:")
|
|
|
|
.replace("components/", "")
|
|
|
|
);
|
|
|
|
return this.findTemplate(connectorParsedName, "javascripts/");
|
|
|
|
}
|
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
|
|
|
findPluginTemplate(parsedName) {
|
2022-07-06 21:20:00 +08:00
|
|
|
return this.findTemplate(parsedName, "javascripts/");
|
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
|
|
|
findPluginMobileTemplate(parsedName) {
|
2016-11-04 02:15:26 +08:00
|
|
|
if (_options.mobileView) {
|
2022-07-06 21:20:00 +08:00
|
|
|
return this.findTemplate(parsedName, "javascripts/mobile/");
|
2016-08-31 23:30:51 +08:00
|
|
|
}
|
2022-07-06 21:20:00 +08:00
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
|
|
|
findMobileTemplate(parsedName) {
|
2016-11-04 02:15:26 +08:00
|
|
|
if (_options.mobileView) {
|
2022-07-06 21:20:00 +08:00
|
|
|
return this.findTemplate(parsedName, "mobile/");
|
2016-08-31 23:30:51 +08:00
|
|
|
}
|
2022-07-06 21:20:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
findTemplate(parsedName, prefix) {
|
|
|
|
prefix = prefix || "";
|
2016-08-31 23:30:51 +08:00
|
|
|
|
|
|
|
const withoutType = parsedName.fullNameWithoutType,
|
2022-07-06 21:20:00 +08:00
|
|
|
underscored = decamelize(withoutType).replace(/-/g, "_"),
|
|
|
|
segments = withoutType.split("/"),
|
2016-08-31 23:30:51 +08:00
|
|
|
templates = Ember.TEMPLATES;
|
2018-06-15 23:03:24 +08:00
|
|
|
|
2016-08-31 23:30:51 +08:00
|
|
|
return (
|
2022-07-06 21:20:00 +08:00
|
|
|
// Convert dots and dashes to slashes
|
|
|
|
templates[prefix + withoutType.replace(/[\.-]/g, "/")] ||
|
|
|
|
// Default unmodified behavior of original resolveTemplate.
|
|
|
|
templates[prefix + withoutType] ||
|
|
|
|
// Underscored without namespace
|
|
|
|
templates[prefix + underscored] ||
|
|
|
|
// Underscored with first segment as directory
|
|
|
|
templates[prefix + underscored.replace("_", "/")] ||
|
|
|
|
// Underscore only the last segment
|
|
|
|
templates[
|
|
|
|
`${prefix}${segments.slice(0, -1).join("/")}/${segments[
|
|
|
|
segments.length - 1
|
|
|
|
].replace(/-/g, "_")}`
|
|
|
|
] ||
|
|
|
|
// All dasherized
|
|
|
|
templates[prefix + withoutType.replace(/\//g, "-")]
|
2016-08-31 23:30:51 +08:00
|
|
|
);
|
2022-07-06 21:20:00 +08:00
|
|
|
}
|
2016-08-31 23:30:51 +08:00
|
|
|
|
|
|
|
// Try to find a template within a special admin namespace, e.g. adminEmail => admin/templates/email
|
|
|
|
// (similar to how discourse lays out templates)
|
|
|
|
findAdminTemplate(parsedName) {
|
2022-07-06 21:20:00 +08:00
|
|
|
if (parsedName.fullNameWithoutType === "admin") {
|
2016-08-31 23:30:51 +08:00
|
|
|
return Ember.TEMPLATES["admin/templates/admin"];
|
|
|
|
}
|
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
let namespaced, match;
|
|
|
|
|
|
|
|
if (parsedName.fullNameWithoutType.startsWith("components/")) {
|
2022-07-27 00:03:49 +08:00
|
|
|
return (
|
|
|
|
// Built-in
|
|
|
|
this.findTemplate(parsedName, "admin/templates/") ||
|
|
|
|
// Plugin
|
|
|
|
this.findTemplate(parsedName, "javascripts/admin/")
|
|
|
|
);
|
2022-07-06 21:20:00 +08:00
|
|
|
} else if (/^admin[_\.-]/.test(parsedName.fullNameWithoutType)) {
|
|
|
|
namespaced = parsedName.fullNameWithoutType.slice(6);
|
|
|
|
} else if (
|
|
|
|
(match = parsedName.fullNameWithoutType.match(/^admin([A-Z])(.+)$/))
|
2016-08-31 23:30:51 +08:00
|
|
|
) {
|
2022-07-06 21:20:00 +08:00
|
|
|
namespaced = `${match[1].toLowerCase()}${match[2]}`;
|
2016-08-31 23:30:51 +08:00
|
|
|
}
|
2022-06-17 20:50:21 +08:00
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
let resolved;
|
|
|
|
|
|
|
|
if (namespaced) {
|
|
|
|
let adminParsedName = this.parseName(`template:${namespaced}`);
|
|
|
|
resolved =
|
|
|
|
// Built-in
|
|
|
|
this.findTemplate(adminParsedName, "admin/templates/") ||
|
2022-08-03 17:12:17 +08:00
|
|
|
this.findTemplate(parsedName, "admin/templates/") ||
|
2022-07-06 21:20:00 +08:00
|
|
|
// Plugin
|
|
|
|
this.findTemplate(adminParsedName, "javascripts/admin/");
|
2022-06-17 20:50:21 +08:00
|
|
|
}
|
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
return resolved;
|
|
|
|
}
|
|
|
|
|
|
|
|
findWizardTemplate(parsedName) {
|
|
|
|
if (parsedName.fullNameWithoutType === "wizard") {
|
2022-06-17 20:50:21 +08:00
|
|
|
return Ember.TEMPLATES["wizard/templates/wizard"];
|
|
|
|
}
|
|
|
|
|
2022-07-06 21:20:00 +08:00
|
|
|
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 adminParsedName = this.parseName(
|
|
|
|
`template:wizard/templates/${namespaced}`
|
2022-06-17 20:50:21 +08:00
|
|
|
);
|
2022-07-06 21:20:00 +08:00
|
|
|
return this.findTemplate(adminParsedName);
|
2022-06-17 20:50:21 +08:00
|
|
|
}
|
2022-07-06 21:20:00 +08:00
|
|
|
}
|
|
|
|
};
|
2016-08-31 23:30:51 +08:00
|
|
|
}
|