mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 21:20:57 +08:00
The admin email templates page currently uses a dropdown that lists all available templates for navigating between the templates. This is an odd way of navigation and inconsistent with how navigation is implemented in other admin pages. This commit replaces the dropdown with a dedicated index page that lists all templates in a table with an edit button for each row that navigates to the edit page for the respective template. Internal topic: t/162739.
24 lines
672 B
JavaScript
Vendored
24 lines
672 B
JavaScript
Vendored
import { tracked } from "@glimmer/tracking";
|
|
import Controller from "@ember/controller";
|
|
import { action } from "@ember/object";
|
|
import { sort } from "@ember/object/computed";
|
|
|
|
export default class AdminEmailTemplatesIndexController extends Controller {
|
|
@tracked showOverridenOnly = false;
|
|
|
|
titleSorting = ["title"];
|
|
@sort("emailTemplates", "titleSorting") sortedTemplates;
|
|
|
|
get shownTemplates() {
|
|
if (this.showOverridenOnly) {
|
|
return this.sortedTemplates.filter((template) => template.can_revert);
|
|
} else {
|
|
return this.sortedTemplates;
|
|
}
|
|
}
|
|
|
|
@action
|
|
toggleOverridenOnly() {
|
|
this.showOverridenOnly = !this.showOverridenOnly;
|
|
}
|
|
}
|