mirror of
https://github.com/discourse/discourse.git
synced 2024-12-22 19:44:44 +08:00
f902e0fdd7
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
This PR: - Removes components from being displayed in the card - Adds a DMenu to house previous footer actions - Allows themes to be updated from this grid, with an animation and different border to show the update is happening - Stops position of cards changing when default changes - Fixes outline colour not changing when default changes - Show a global notice on the page when previewing a theme - Allows updating a theme from the grid, and showing an indicator of what theme needs to be updated - Moves "Set as default" to the dropdown for the theme - Show screenshot for theme if it is available - Prevent page reloading when updating the theme - Fixes theme install modal on grid page - Temporarily remove sorting of default theme to the top
57 lines
1.8 KiB
Plaintext
57 lines
1.8 KiB
Plaintext
import Component from "@glimmer/component";
|
|
import { service } from "@ember/service";
|
|
import ThemesGridCard from "./themes-grid-card";
|
|
|
|
// NOTE (martin): Much of the JS code in this component is placeholder code. Much
|
|
// of the existing theme logic in /admin/customize/themes has old patterns
|
|
// and technical debt, so anything copied from there to here is subject
|
|
// to change as we improve this incrementally.
|
|
export default class ThemesGrid extends Component {
|
|
@service modal;
|
|
@service router;
|
|
|
|
sortedThemes;
|
|
|
|
externalResources = [
|
|
{
|
|
key: "admin.customize.theme.beginners_guide_title",
|
|
link: "https://meta.discourse.org/t/91966",
|
|
},
|
|
{
|
|
key: "admin.customize.theme.developers_guide_title",
|
|
link: "https://meta.discourse.org/t/93648",
|
|
},
|
|
{
|
|
key: "admin.customize.theme.browse_themes",
|
|
link: "https://meta.discourse.org/c/theme",
|
|
},
|
|
];
|
|
|
|
constructor() {
|
|
super(...arguments);
|
|
|
|
// Show default theme at the top of the list on page load,
|
|
// but don't move it around dynamically if the admin changes the default.
|
|
//
|
|
// TODO (martin) Figure out how to make it so we can sort default to the
|
|
// top but also allow the list of themes to change if an additional theme is
|
|
// installed. Basically don't want .get("default") to affect the sort after
|
|
// the first time, but if the whole array changes this needs to be recalculated.
|
|
this.sortedThemes = this.args.themes.sort((a, b) => {
|
|
if (a.get("default")) {
|
|
return -1;
|
|
} else if (b.get("default")) {
|
|
return 1;
|
|
}
|
|
});
|
|
}
|
|
|
|
<template>
|
|
<div class="themes-cards-container">
|
|
{{#each @themes as |theme|}}
|
|
<ThemesGridCard @theme={{theme}} @allThemes={{@themes}} />
|
|
{{/each}}
|
|
</div>
|
|
</template>
|
|
}
|