mirror of
https://github.com/discourse/discourse.git
synced 2025-03-14 10:33:43 +00:00
There are a number of minor changes in this commit : 1. Combine the "Themes" and "Components" links in the admin sidebar into a single tab labelled "Themes and components" 2. The combined tab links to the `/admin/config/customize/themes` page (titled as "Themes and components") 3. Add a new "Components" tab to the "Themes and components" page. There's already an existing "Themes" tab 4. Add a "back to" link at the top of individual theme/component page to navigate back to the respective tab in the "Themes and components" page 5. Remove the themes/components list/sidebar that currently serves for navigating between themes/components 6. Remove the header in the theme/component page Changes 4–6 apply only if the admin sidebar is enabled; they have no effect otherwise. Internal topic: t/146006.
64 lines
1.7 KiB
Plaintext
64 lines
1.7 KiB
Plaintext
import Component from "@glimmer/component";
|
|
import { action } from "@ember/object";
|
|
import { service } from "@ember/service";
|
|
import { i18n } from "discourse-i18n";
|
|
import InstallThemeCard from "admin/components/admin-config-area-cards/install-theme-card";
|
|
import InstallComponentModal from "admin/components/modal/install-theme";
|
|
import ThemesGrid from "admin/components/themes-grid";
|
|
import { COMPONENTS } from "admin/models/theme";
|
|
|
|
export default class AdminConfigAreasComponents extends Component {
|
|
@service modal;
|
|
@service router;
|
|
@service toasts;
|
|
|
|
@action
|
|
installModal() {
|
|
this.modal.show(InstallComponentModal, {
|
|
model: { ...this.installOptions() },
|
|
});
|
|
}
|
|
|
|
// TODO (martin) These install methods may not belong here and they
|
|
// are incomplete or have stubbed or omitted properties. We may want
|
|
// to move this to the new config route or a dedicated component
|
|
// that sits in the route.
|
|
installOptions() {
|
|
return {
|
|
selectedType: COMPONENTS,
|
|
userId: null,
|
|
content: [],
|
|
installedThemes: this.args.components,
|
|
addTheme: this.addComponent,
|
|
updateSelectedType: () => {},
|
|
showComponentsOnly: true,
|
|
};
|
|
}
|
|
|
|
@action
|
|
addComponent(component) {
|
|
this.toasts.success({
|
|
data: {
|
|
message: i18n("admin.customize.theme.install_success", {
|
|
theme: component.name,
|
|
}),
|
|
},
|
|
duration: 2000,
|
|
});
|
|
this.router.refresh();
|
|
}
|
|
|
|
<template>
|
|
<div class="admin-detail">
|
|
<ThemesGrid @themes={{@components}}>
|
|
<:specialCard>
|
|
<InstallThemeCard
|
|
@component={{true}}
|
|
@openModal={{this.installModal}}
|
|
/>
|
|
</:specialCard>
|
|
</ThemesGrid>
|
|
</div>
|
|
</template>
|
|
}
|