mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-26 01:04:55 +08:00
This commit removes the color palette dropdown from the theme page and replaces it with a new "Colors" tab where the theme's color palette can be edited directly in that tab on the theme page. With this change, a theme's color palette is strongly tied to its theme and can't be linked to other themes and it can't be selected by users without using the theme as well. All of the changes are behind a feature flag. To enable it, turn on the `use_overhauled_theme_color_palette` setting. Co-authored-by: Ella <ella.estigoy@gmail.com>
35 lines
1.3 KiB
JavaScript
Vendored
35 lines
1.3 KiB
JavaScript
Vendored
import { ajax } from "discourse/lib/ajax";
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
import { i18n } from "discourse-i18n";
|
|
import Theme from "admin/models/theme";
|
|
|
|
export default class AdminConfigThemesAndComponentsThemesRoute extends DiscourseRoute {
|
|
queryParams = {
|
|
repoUrl: { replace: true },
|
|
repoName: { replace: true },
|
|
};
|
|
|
|
async model(params) {
|
|
const data = await ajax("/admin/config/customize/themes");
|
|
return {
|
|
themes: data.themes.map((theme) =>
|
|
// TODO(osama) MEGA HACK. remove the __type and __state properties when
|
|
// we have rebuilt the theme "show" page and stopped requiring all
|
|
// themes/components be loaded for the page.
|
|
// If we use the store to load the themes here, the logic in afterFindAll
|
|
// interfers with the themes objects already loaded for the theme "show"
|
|
// page and breaks it.
|
|
// If we don't use the store (and remove the __type and __state props
|
|
// here), then the save method on the theme model breaks because it
|
|
// expects the theme to be a store object.
|
|
Theme.create({ ...theme, __type: "theme", __state: "created" })
|
|
),
|
|
repoUrl: params.repoUrl,
|
|
repoName: params.repoName,
|
|
};
|
|
}
|
|
|
|
titleToken() {
|
|
return i18n("admin.config_areas.themes_and_components.themes.title");
|
|
}
|
|
}
|