discourse/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjs
dependabot[bot] e7d3c344d1
Build(deps-dev): Bump the lint group across 1 directory with 4 updates (#33881)
Bumps the lint group with 4 updates in the / directory:
[@discourse/lint-configs](https://github.com/discourse/lint-configs),
[ember-template-lint](https://github.com/ember-template-lint/ember-template-lint),
[eslint](https://github.com/eslint/eslint) and
[stylelint](https://github.com/stylelint/stylelint).


Updates `@discourse/lint-configs` from 2.22.0 to 2.28.0
- [Commits](https://github.com/discourse/lint-configs/commits)

Updates `ember-template-lint` from 7.7.0 to 7.9.1
- [Release
notes](https://github.com/ember-template-lint/ember-template-lint/releases)
-
[Changelog](https://github.com/ember-template-lint/ember-template-lint/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/ember-template-lint/ember-template-lint/commits)

Updates `eslint` from 9.27.0 to 9.32.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.27.0...v9.32.0)

Updates `stylelint` from 16.19.1 to 16.22.0
- [Release notes](https://github.com/stylelint/stylelint/releases)
-
[Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/stylelint/stylelint/compare/16.19.1...16.22.0)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Discourse CI <ci@ci.invalid>
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-07-28 18:02:41 +02:00

278 lines
9.9 KiB
Text
Vendored

import { LinkTo } from "@ember/routing";
import { htmlSafe } from "@ember/template";
import RouteTemplate from "ember-route-template";
import DButton from "discourse/components/d-button";
import DPageHeader from "discourse/components/d-page-header";
import NavItem from "discourse/components/nav-item";
import PluginOutlet from "discourse/components/plugin-outlet";
import TextField from "discourse/components/text-field";
import UserLink from "discourse/components/user-link";
import avatar from "discourse/helpers/avatar";
import icon from "discourse/helpers/d-icon";
import formatDate from "discourse/helpers/format-date";
import lazyHash from "discourse/helpers/lazy-hash";
import { i18n } from "discourse-i18n";
export default RouteTemplate(
<template>
<div class="show-current-style">
<div class="back-to-themes-and-components">
<LinkTo
@route={{if
@controller.model.component
"adminConfig.customize.components"
"adminConfig.customize.themes"
}}
>
{{icon "angle-left"}}
{{i18n
(if
@controller.model.component
"admin.config_areas.themes_and_components.components.back"
"admin.config_areas.themes_and_components.themes.back"
)
}}
</LinkTo>
</div>
<span>
<PluginOutlet
@name="admin-customize-themes-show-top"
@connectorTagName="div"
@outletArgs={{lazyHash theme=@controller.model}}
/>
</span>
<div class="title">
{{#if @controller.editingName}}
<div class="container-edit-title">
<TextField @value={{@controller.model.name}} @autofocus="true" />
<DButton
@action={{@controller.finishedEditingName}}
@icon="check"
class="btn-primary btn-small submit-edit"
/>
<DButton
@action={{@controller.cancelEditingName}}
@icon="xmark"
class="btn-small cancel-edit"
/>
</div>
{{else}}
<DButton
@action={{@controller.startEditingName}}
class="btn-transparent title-button"
role="heading"
aria-level="2"
aria-label="Edit theme name: {{@controller.model.name}}"
>
<span>{{@controller.model.name}}</span>
{{#unless @controller.model.system}}
{{icon "pencil" class="inline-icon"}}
{{/unless}}
</DButton>
{{/if}}
</div>
<PluginOutlet
@name="admin-customize-theme-before-errors"
@outletArgs={{lazyHash theme=@controller.model}}
/>
{{#each @controller.model.errors as |error|}}
<div class="alert alert-error">{{error}}</div>
{{/each}}
{{#if @controller.finishInstall}}
<div class="control-unit">
{{#if @controller.sourceIsHttp}}
<a class="remote-url" href={{@controller.remoteThemeLink}}>{{i18n
"admin.customize.theme.source_url"
}}{{icon "link"}}</a>
{{else}}
<div class="remote-url">
<code>{{@controller.model.remote_theme.remote_url}}</code>
{{#if @controller.model.remote_theme.branch}}
(<code>{{@controller.model.remote_theme.branch}}</code>)
{{/if}}
</div>
{{/if}}
{{#if @controller.showRemoteError}}
<div class="error-message">
{{icon "triangle-exclamation"}}
{{i18n "admin.customize.theme.repo_unreachable"}}
</div>
<div class="raw-error">
<code>{{@controller.model.remoteError}}</code>
</div>
{{/if}}
<DButton
@action={{@controller.updateToLatest}}
@icon="download"
@label="admin.customize.theme.finish_install"
class="btn-primary finish-install"
/>
<DButton
@action={{@controller.destroyTheme}}
@label="admin.customize.delete"
@icon="trash-can"
class="btn-danger"
/>
<span class="status-message">
{{i18n "admin.customize.theme.last_attempt"}}
{{formatDate
@controller.model.remote_theme.updated_at
leaveAgo="true"
}}
</span>
</div>
{{else}}
{{#unless @controller.model.supported}}
<div class="alert alert-error">
{{i18n "admin.customize.theme.required_version.error"}}
{{#if @controller.model.remote_theme.minimum_discourse_version}}
{{i18n
"admin.customize.theme.required_version.minimum"
version=@controller.model.remote_theme.minimum_discourse_version
}}
{{/if}}
{{#if @controller.model.remote_theme.maximum_discourse_version}}
{{i18n
"admin.customize.theme.required_version.maximum"
version=@controller.model.remote_theme.maximum_discourse_version
}}
{{/if}}
</div>
{{/unless}}
{{#unless @controller.model.enabled}}
<div class="alert alert-error">
{{#if @controller.model.disabled_by}}
{{i18n "admin.customize.theme.disabled_by"}}
<UserLink @user={{@controller.model.disabled_by}}>
{{avatar @controller.model.disabled_by imageSize="tiny"}}
{{@controller.model.disabled_by.username}}
</UserLink>
{{formatDate @controller.model.disabled_at leaveAgo="true"}}
{{else}}
{{i18n "admin.customize.theme.disabled"}}
{{/if}}
<DButton
@action={{@controller.enableComponent}}
@icon="check"
@label="admin.customize.theme.enable"
class="btn-default"
/>
</div>
{{/unless}}
<div class="metadata control-unit remote-theme-metadata">
{{#if @controller.model.remote_theme}}
{{#if @controller.model.remote_theme.remote_url}}
{{#if @controller.sourceIsHttp}}
<a
class="remote-url"
href={{@controller.remoteThemeLink}}
>{{i18n "admin.customize.theme.source_url"}}{{icon "link"}}</a>
{{else}}
<div class="remote-url">
<code>{{@controller.model.remote_theme.remote_url}}</code>
{{#if @controller.model.remote_theme.branch}}
(<code>{{@controller.model.remote_theme.branch}}</code>)
{{/if}}
</div>
{{/if}}
{{/if}}
{{#if @controller.model.remote_theme.about_url}}
<a
class="url about-url"
href={{@controller.model.remote_theme.about_url}}
>{{i18n "admin.customize.theme.about_theme"}}{{icon "link"}}</a>
{{/if}}
{{#if @controller.model.remote_theme.license_url}}
<a
class="url license-url"
href={{@controller.model.remote_theme.license_url}}
>{{i18n "admin.customize.theme.license"}}{{icon "link"}}</a>
{{/if}}
{{#if @controller.model.description}}
<span
class="theme-description"
>{{@controller.model.description}}</span>
{{/if}}
{{#if @controller.model.remote_theme.authors}}<span
class="authors"
><span class="heading">{{i18n
"admin.customize.theme.authors"
}}</span>
{{@controller.model.remote_theme.authors}}</span>{{/if}}
{{#if @controller.model.remote_theme.theme_version}}<span
class="version"
><span class="heading">{{i18n
"admin.customize.theme.version"
}}</span>
{{@controller.model.remote_theme.theme_version}}</span>{{/if}}
{{#if @controller.model.remote_theme.is_git}}
<div class="alert alert-info remote-theme-edits">
{{htmlSafe
(i18n
"admin.customize.theme.remote_theme_edits"
repoURL=@controller.remoteThemeLink
)
}}
</div>
{{#if @controller.showRemoteError}}
<div class="error-message">
{{icon "triangle-exclamation"}}
{{i18n "admin.customize.theme.repo_unreachable"}}
</div>
<div class="raw-error">
<code>{{@controller.model.remoteError}}</code>
</div>
{{/if}}
{{/if}}
{{/if}}
</div>
{{#if @controller.model.system}}
<div class="alert alert-info system-theme-info">
{{i18n "admin.customize.theme.built_in_description"}}
</div>
{{/if}}
{{#if @controller.siteSettings.use_overhauled_theme_color_palette}}
{{#unless @controller.model.component}}
<DPageHeader>
<:tabs>
<NavItem
class="admin-customize-theme-tabs__settings"
@route="adminCustomizeThemes.show.index"
@routeParam={{@controller.model.id}}
@label="admin.customize.theme.settings"
/>
<NavItem
class="admin-customize-theme-tabs__colors"
@route="adminCustomizeThemes.show.colors"
@routeParam={{@controller.model.id}}
@label="admin.customize.theme.colors"
/>
</:tabs>
</DPageHeader>
{{/unless}}
{{/if}}
{{outlet}}
{{/if}}
</div>
</template>
);