discourse/app/assets/javascripts/admin/addon/templates/admin-watched-words.gjs
David Taylor 6081bc2249
DEV: Standardize Ember route, controller and template naming (#34417)
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.
2025-09-25 11:27:45 +01:00

73 lines
2.3 KiB
Text
Vendored

import { LinkTo } from "@ember/routing";
import RouteTemplate from "ember-route-template";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import DButton from "discourse/components/d-button";
import DPageHeader from "discourse/components/d-page-header";
import TextField from "discourse/components/text-field";
import { i18n } from "discourse-i18n";
export default RouteTemplate(
<template>
<DPageHeader
@titleLabel={{i18n "admin.config.watched_words.title"}}
@descriptionLabel={{i18n "admin.config.watched_words.header_description"}}
@learnMoreUrl="https://meta.discourse.org/t/241735"
@hideTabs={{true}}
>
<:breadcrumbs>
<DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
<DBreadcrumbsItem
@path="/admin/customize/watched_words"
@label={{i18n "admin.config.watched_words.title"}}
/>
</:breadcrumbs>
</DPageHeader>
<div class="admin-contents">
<div class="admin-controls">
<div class="controls">
<div class="inline-form">
<DButton
@action={{@controller.toggleMenu}}
@icon="bars"
class="menu-toggle"
/>
<TextField
@value={{@controller.filter}}
@placeholderKey="admin.watched_words.search"
class="no-blur"
/>
<DButton
@action={{@controller.clearFilter}}
@label="admin.watched_words.clear_filter"
/>
</div>
</div>
</div>
<div class="admin-nav pull-left">
<ul class="nav nav-stacked">
{{#each @controller.model as |watchedWordAction|}}
<li class={{watchedWordAction.nameKey}}>
<LinkTo
@route="adminWatchedWords.action"
@model={{watchedWordAction.nameKey}}
>
{{watchedWordAction.name}}
{{#if watchedWordAction.words}}<span
class="count"
>({{watchedWordAction.words.length}})</span>{{/if}}
</LinkTo>
</li>
{{/each}}
</ul>
</div>
<div class="admin-detail pull-left mobile-closed watched-words-detail">
{{outlet}}
</div>
<div class="clearfix"></div>
</div>
</template>
);