discourse/app/assets/javascripts/admin/addon/templates/embedding-index.gjs
Ella E. b4a376bd9a
DEV: Use reusable d-table instead of admin-only styles (#33531)
Follow up to https://github.com/discourse/discourse/pull/33253

Switches to the generic `d-table` class instead of using the admin
stylesheet. No visual changes, except the badge/status for the API key.

| Before | After |
|--------|--------|
|
![image](https://github.com/user-attachments/assets/e4d1a0ad-8e60-4ad8-b3b1-d17b66b878e8)
|
![image](https://github.com/user-attachments/assets/5bc41353-c4a0-486b-b730-451b9f737341)
|
2025-07-10 19:58:04 -06:00

72 lines
2.6 KiB
Text
Vendored

import RouteTemplate from "ember-route-template";
import PluginOutlet from "discourse/components/plugin-outlet";
import htmlSafe from "discourse/helpers/html-safe";
import lazyHash from "discourse/helpers/lazy-hash";
import { i18n } from "discourse-i18n";
import AdminConfigAreaCard from "admin/components/admin-config-area-card";
import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list";
import EmbeddableHost from "admin/components/embeddable-host";
import HighlightedCode from "admin/components/highlighted-code";
export default RouteTemplate(
<template>
{{#if @controller.embedding.embeddable_hosts}}
{{#if @controller.showEmbeddingCode}}
<AdminConfigAreaCard
@heading="admin.embedding.configuration_snippet"
@collapsable={{true}}
@collapsed={{true}}
class="admin-embedding-index__code"
>
<:content>
{{htmlSafe (i18n "admin.embedding.sample")}}
<HighlightedCode @code={{@controller.embeddingCode}} @lang="html" />
</:content>
</AdminConfigAreaCard>
{{/if}}
<table class="d-table">
<thead class="d-table__header">
<th class="d-table__header-cell">{{i18n "admin.embedding.host"}}</th>
<th class="d-table__header-cell">{{i18n
"admin.embedding.allowed_paths"
}}</th>
<th class="d-table__header-cell">{{i18n
"admin.embedding.category"
}}</th>
<th class="d-table__header-cell">{{i18n "admin.embedding.tags"}}</th>
{{#if @controller.embedding.embed_by_username}}
<th class="d-table__header-cell">{{i18n
"admin.embedding.post_author_with_default"
author=@controller.embedding.embed_by_username
}}</th>
{{else}}
<th class="d-table__header-cell">{{i18n
"admin.embedding.post_author"
}}</th>
{{/if}}
</thead>
<tbody class="d-table__body">
{{#each @controller.embedding.embeddable_hosts as |host|}}
<EmbeddableHost
@host={{host}}
@deleteHost={{@controller.deleteHost}}
/>
{{/each}}
</tbody>
</table>
{{else}}
<AdminConfigAreaEmptyList
@ctaLabel="admin.embedding.add_host"
@ctaRoute="adminEmbedding.new"
@ctaClass="admin-embedding__add-host"
@emptyLabel="admin.embedding.get_started"
/>
{{/if}}
<PluginOutlet
@name="after-embeddable-hosts-table"
@outletArgs={{lazyHash embedding=@controller.embedding}}
/>
</template>
);