mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-21 23:19:22 +08:00
For historical reasons, Discourse has a customized Ember resolver. This had a much more fuzzy implementation of 'normalize' and 'findTemplate' functions. This leniency meant that our file naming hasn't always matched Ember conventions. Standardizing our naming will make things easier to understand for developers, and will make adoption of newer ecosystem tooling easier (e.g. route-based bundle splitting in Embroider/vite) This commit adds deprecations to the resolver when this leniency is used, and uses a fully bespoke codemod to rename all of the affected routes/controllers/templates in the Discourse core repository. Backwards-compatibility is maintained for anyone looking up the old names in the resolver.
54 lines
1.9 KiB
Text
Vendored
54 lines
1.9 KiB
Text
Vendored
import RouteTemplate from "ember-route-template";
|
|
import DBreadcrumbsContainer from "discourse/components/d-breadcrumbs-container";
|
|
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
|
|
import HorizontalOverflowNav from "discourse/components/horizontal-overflow-nav";
|
|
import NavItem from "discourse/components/nav-item";
|
|
import { i18n } from "discourse-i18n";
|
|
|
|
export default RouteTemplate(
|
|
<template>
|
|
{{#if @controller.showTopNav}}
|
|
<div class="d-page-header">
|
|
<DBreadcrumbsContainer />
|
|
<DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
|
|
<DBreadcrumbsItem
|
|
@path="/admin/plugins"
|
|
@label={{i18n "admin.config.plugins.title"}}
|
|
/>
|
|
<div class="d-nav-submenu">
|
|
<HorizontalOverflowNav class="main-nav nav plugin-nav">
|
|
<NavItem @route="adminPlugins.index" @label="admin.plugins.title" />
|
|
{{#each @controller.adminRoutes as |route|}}
|
|
{{#if route.use_new_show_route}}
|
|
<NavItem
|
|
@route={{route.full_location}}
|
|
@label={{route.label}}
|
|
@routeParam={{route.location}}
|
|
@class="admin-plugin-tab-nav-item"
|
|
data-plugin-nav-tab-id={{route.plugin_id}}
|
|
/>
|
|
{{else}}
|
|
<NavItem
|
|
@route={{route.full_location}}
|
|
@label={{route.label}}
|
|
@class="admin-plugin-tab-nav-item"
|
|
data-plugin-nav-tab-id={{route.plugin_id}}
|
|
/>
|
|
{{/if}}
|
|
{{/each}}
|
|
</HorizontalOverflowNav>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
|
|
<div class="admin-config-page -no-header">
|
|
{{#each @controller.brokenAdminRoutes as |route|}}
|
|
<div class="alert alert-error">
|
|
{{i18n "admin.plugins.broken_route" name=(i18n route.label)}}
|
|
</div>
|
|
{{/each}}
|
|
|
|
{{outlet}}
|
|
</div>
|
|
</template>
|
|
);
|