From 407fa697789adfabe69b56625ac7be3f7ffe8317 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Mon, 6 Jan 2025 13:01:08 +1100 Subject: [PATCH] UX: admins embedding page follows admin ux guideline (#30122) Conversion of /admin/customize/embedding page to follow admin UX guidelines. --- .../components/admin-config-area-card.gjs | 2 +- .../components/admin-embedding-host-form.gjs | 143 ++++++++++++++++ .../addon/components/embeddable-host.gjs | 76 +++++++++ .../addon/components/embeddable-host.hbs | 87 ---------- .../admin/addon/components/embeddable-host.js | 101 ------------ .../addon/components/embedding-setting.hbs | 15 -- .../addon/components/embedding-setting.js | 32 ---- .../controllers/admin-embedding-crawlers.js | 38 +++++ .../controllers/admin-embedding-index.js | 43 +++++ .../admin-embedding-posts-and-topics.js | 46 ++++++ .../controllers/admin-embedding-settings.js | 3 + .../addon/controllers/admin-embedding.js | 60 +------ .../addon/routes/admin-embedding-edit.js | 15 ++ .../admin/addon/routes/admin-embedding-new.js | 8 + .../admin/addon/routes/admin-route-map.js | 19 ++- .../addon/templates/embedding-crawlers.hbs | 32 ++++ .../admin/addon/templates/embedding-edit.hbs | 1 + .../admin/addon/templates/embedding-index.hbs | 49 ++++++ .../admin/addon/templates/embedding-new.hbs | 1 + .../templates/embedding-posts-and-topics.hbs | 53 ++++++ .../addon/templates/embedding-settings.hbs | 6 + .../admin/addon/templates/embedding.hbs | 156 ++++++------------ .../addon/templates/permalinks-index.hbs | 4 +- .../admin/addon/templates/permalinks.hbs | 1 - .../admin-config-area-card-test.gjs | 14 ++ .../stylesheets/common/admin/customize.scss | 27 +-- .../admin/embeddable_hosts_controller.rb | 2 +- app/controllers/admin/embedding_controller.rb | 14 +- app/models/embedding.rb | 19 +-- app/models/site_setting.rb | 2 +- config/locales/client.en.yml | 44 +++-- config/routes.rb | 1 + config/site_settings.yml | 32 +++- .../admin/embedding_controller_spec.rb | 19 ++- spec/system/admin_embeddable_hosts_spec.rb | 88 ++++++---- .../page_objects/pages/admin_embedding.rb | 41 +++++ .../pages/admin_embedding_host_form.rb | 53 ++++++ .../pages/admin_embedding_posts_and_topics.rb | 24 +++ 38 files changed, 870 insertions(+), 501 deletions(-) create mode 100644 app/assets/javascripts/admin/addon/components/admin-embedding-host-form.gjs create mode 100644 app/assets/javascripts/admin/addon/components/embeddable-host.gjs delete mode 100644 app/assets/javascripts/admin/addon/components/embeddable-host.hbs delete mode 100644 app/assets/javascripts/admin/addon/components/embeddable-host.js delete mode 100644 app/assets/javascripts/admin/addon/components/embedding-setting.hbs delete mode 100644 app/assets/javascripts/admin/addon/components/embedding-setting.js create mode 100644 app/assets/javascripts/admin/addon/controllers/admin-embedding-crawlers.js create mode 100644 app/assets/javascripts/admin/addon/controllers/admin-embedding-index.js create mode 100644 app/assets/javascripts/admin/addon/controllers/admin-embedding-posts-and-topics.js create mode 100644 app/assets/javascripts/admin/addon/controllers/admin-embedding-settings.js create mode 100644 app/assets/javascripts/admin/addon/routes/admin-embedding-edit.js create mode 100644 app/assets/javascripts/admin/addon/routes/admin-embedding-new.js create mode 100644 app/assets/javascripts/admin/addon/templates/embedding-crawlers.hbs create mode 100644 app/assets/javascripts/admin/addon/templates/embedding-edit.hbs create mode 100644 app/assets/javascripts/admin/addon/templates/embedding-index.hbs create mode 100644 app/assets/javascripts/admin/addon/templates/embedding-new.hbs create mode 100644 app/assets/javascripts/admin/addon/templates/embedding-posts-and-topics.hbs create mode 100644 app/assets/javascripts/admin/addon/templates/embedding-settings.hbs create mode 100644 spec/system/page_objects/pages/admin_embedding.rb create mode 100644 spec/system/page_objects/pages/admin_embedding_host_form.rb create mode 100644 spec/system/page_objects/pages/admin_embedding_posts_and_topics.rb diff --git a/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs b/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs index 85b5541f654..6eb1f5a4481 100644 --- a/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs +++ b/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs @@ -6,7 +6,7 @@ import icon from "discourse-common/helpers/d-icon"; import { i18n } from "discourse-i18n"; export default class AdminConfigAreaCard extends Component { - @tracked collapsed = false; + @tracked collapsed = this.args.collapsed; get computedHeading() { if (this.args.heading) { diff --git a/app/assets/javascripts/admin/addon/components/admin-embedding-host-form.gjs b/app/assets/javascripts/admin/addon/components/admin-embedding-host-form.gjs new file mode 100644 index 00000000000..06cf3dc9c95 --- /dev/null +++ b/app/assets/javascripts/admin/addon/components/admin-embedding-host-form.gjs @@ -0,0 +1,143 @@ +import Component from "@glimmer/component"; +import { inject as controller } from "@ember/controller"; +import { hash } from "@ember/helper"; +import { action } from "@ember/object"; +import { service } from "@ember/service"; +import { isEmpty } from "@ember/utils"; +import BackButton from "discourse/components/back-button"; +import Form from "discourse/components/form"; +import { popupAjaxError } from "discourse/lib/ajax-error"; +import { i18n } from "discourse-i18n"; +import AdminConfigAreaCard from "admin/components/admin-config-area-card"; +import CategoryChooser from "select-kit/components/category-chooser"; +import TagChooser from "select-kit/components/tag-chooser"; +import UserChooser from "select-kit/components/user-chooser"; + +export default class AdminEmbeddingHostForm extends Component { + @service router; + @service site; + @service store; + @controller adminEmbedding; + + get isEditing() { + return this.args.host; + } + + get header() { + return this.isEditing + ? "admin.embedding.host_form.edit_header" + : "admin.embedding.host_form.add_header"; + } + + get formData() { + if (!this.isEditing) { + return {}; + } + + return { + host: this.args.host.host, + allowed_paths: this.args.host.allowed_paths, + category: this.args.host.category_id, + tags: this.args.host.tags, + user: isEmpty(this.args.host.user) ? null : [this.args.host.user], + }; + } + + @action + async save(data) { + const host = this.args.host || this.store.createRecord("embeddable-host"); + + try { + await host.save({ + ...data, + user: data.user?.at(0), + category_id: data.category, + }); + if (!this.isEditing) { + this.adminEmbedding.embedding.embeddable_hosts.push(host); + } + this.router.transitionTo("adminEmbedding"); + } catch (error) { + popupAjaxError(error); + } + } + + +} diff --git a/app/assets/javascripts/admin/addon/components/embeddable-host.gjs b/app/assets/javascripts/admin/addon/components/embeddable-host.gjs new file mode 100644 index 00000000000..1f24a765c0f --- /dev/null +++ b/app/assets/javascripts/admin/addon/components/embeddable-host.gjs @@ -0,0 +1,76 @@ +import Component from "@glimmer/component"; +import { tracked } from "@glimmer/tracking"; +import { action } from "@ember/object"; +import { service } from "@ember/service"; +import DButton from "discourse/components/d-button"; +import categoryBadge from "discourse/helpers/category-badge"; +import Category from "discourse/models/category"; +import { i18n } from "discourse-i18n"; + +export default class EmbeddableHost extends Component { + @service dialog; + @tracked category = null; + @tracked tags = null; + @tracked user = null; + + constructor() { + super(...arguments); + + this.host = this.args.host; + const categoryId = + this.host.category_id || this.site.uncategorized_category_id; + const category = Category.findById(categoryId); + + this.category = category; + this.tags = (this.host.tags || []).join(", "); + this.user = this.host.user; + } + + @action + delete() { + return this.dialog.confirm({ + message: i18n("admin.embedding.confirm_delete"), + didConfirm: () => { + return this.host.destroyRecord().then(() => { + this.args.deleteHost(this.host); + }); + }, + }); + } + + +} diff --git a/app/assets/javascripts/admin/addon/components/embeddable-host.hbs b/app/assets/javascripts/admin/addon/components/embeddable-host.hbs deleted file mode 100644 index eb52efd31e7..00000000000 --- a/app/assets/javascripts/admin/addon/components/embeddable-host.hbs +++ /dev/null @@ -1,87 +0,0 @@ -{{#if this.editing}} - -
{{i18n "admin.embedding.host"}}
- - - -
{{i18n "admin.embedding.allowed_paths"}}
- - - -
{{i18n "admin.embedding.category"}}
- - - -
{{i18n "admin.embedding.tags"}}
- - - -
{{i18n "admin.embedding.user"}}
- - - - - - -{{else}} - -
{{i18n "admin.embedding.host"}}
- {{this.host.host}} - - -
- {{i18n "admin.embedding.allowed_paths"}} -
- {{this.host.allowed_paths}} - - -
{{i18n "admin.embedding.category"}}
- {{category-badge this.category allowUncategorized=true}} - - - {{this.tags}} - - - {{this.user}} - - - - - -{{/if}} \ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/components/embeddable-host.js b/app/assets/javascripts/admin/addon/components/embeddable-host.js deleted file mode 100644 index 8d4ae85cdfe..00000000000 --- a/app/assets/javascripts/admin/addon/components/embeddable-host.js +++ /dev/null @@ -1,101 +0,0 @@ -import Component from "@ember/component"; -import { action } from "@ember/object"; -import { or } from "@ember/object/computed"; -import { service } from "@ember/service"; -import { isEmpty } from "@ember/utils"; -import { tagName } from "@ember-decorators/component"; -import { popupAjaxError } from "discourse/lib/ajax-error"; -import { bufferedProperty } from "discourse/mixins/buffered-content"; -import Category from "discourse/models/category"; -import discourseComputed from "discourse-common/utils/decorators"; -import { i18n } from "discourse-i18n"; - -@tagName("tr") -export default class EmbeddableHost extends Component.extend( - bufferedProperty("host") -) { - @service dialog; - editToggled = false; - categoryId = null; - category = null; - tags = null; - user = null; - - @or("host.isNew", "editToggled") editing; - - init() { - super.init(...arguments); - - const host = this.host; - const categoryId = host.category_id || this.site.uncategorized_category_id; - const category = Category.findById(categoryId); - - this.set("category", category); - this.set("tags", host.tags || []); - this.set("user", host.user); - } - - @discourseComputed("buffered.host", "host.isSaving") - cantSave(host, isSaving) { - return isSaving || isEmpty(host); - } - - @action - edit() { - this.set("editToggled", true); - } - - @action - onUserChange(user) { - this.set("user", user); - } - - @action - save() { - if (this.cantSave) { - return; - } - - const props = this.buffered.getProperties( - "host", - "allowed_paths", - "class_name" - ); - props.category_id = this.category.id; - props.tags = this.tags; - props.user = - Array.isArray(this.user) && this.user.length > 0 ? this.user[0] : null; - - const host = this.host; - - host - .save(props) - .then(() => { - this.set("editToggled", false); - }) - .catch(popupAjaxError); - } - - @action - delete() { - return this.dialog.confirm({ - message: i18n("admin.embedding.confirm_delete"), - didConfirm: () => { - return this.host.destroyRecord().then(() => { - this.deleteHost(this.host); - }); - }, - }); - } - - @action - cancel() { - const host = this.host; - if (host.get("isNew")) { - this.deleteHost(host); - } else { - this.rollbackBuffer(); - this.set("editToggled", false); - } - } -} diff --git a/app/assets/javascripts/admin/addon/components/embedding-setting.hbs b/app/assets/javascripts/admin/addon/components/embedding-setting.hbs deleted file mode 100644 index 40190589e47..00000000000 --- a/app/assets/javascripts/admin/addon/components/embedding-setting.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{#if this.isCheckbox}} - -{{else}} - - -{{/if}} - -
\ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/components/embedding-setting.js b/app/assets/javascripts/admin/addon/components/embedding-setting.js deleted file mode 100644 index 462f27c875a..00000000000 --- a/app/assets/javascripts/admin/addon/components/embedding-setting.js +++ /dev/null @@ -1,32 +0,0 @@ -import Component from "@ember/component"; -import { computed } from "@ember/object"; -import { dasherize } from "@ember/string"; -import { classNames } from "@ember-decorators/component"; -import discourseComputed from "discourse-common/utils/decorators"; - -@classNames("embed-setting") -export default class EmbeddingSetting extends Component { - @discourseComputed("field") - inputId(field) { - return dasherize(field); - } - - @discourseComputed("field") - translationKey(field) { - return `admin.embedding.${field}`; - } - - @discourseComputed("type") - isCheckbox(type) { - return type === "checkbox"; - } - - @computed("value") - get checked() { - return !!this.value; - } - - set checked(value) { - this.set("value", value); - } -} diff --git a/app/assets/javascripts/admin/addon/controllers/admin-embedding-crawlers.js b/app/assets/javascripts/admin/addon/controllers/admin-embedding-crawlers.js new file mode 100644 index 00000000000..9ad57cdad8b --- /dev/null +++ b/app/assets/javascripts/admin/addon/controllers/admin-embedding-crawlers.js @@ -0,0 +1,38 @@ +import Controller, { inject as controller } from "@ember/controller"; +import { action } from "@ember/object"; +import { service } from "@ember/service"; +import { popupAjaxError } from "discourse/lib/ajax-error"; +import { i18n } from "discourse-i18n"; + +export default class AdminEmbeddingCrawlersController extends Controller { + @service toasts; + @controller adminEmbedding; + + get formData() { + const embedding = this.adminEmbedding.embedding; + + return { + allowed_embed_selectors: embedding.allowed_embed_selectors, + blocked_embed_selectors: embedding.blocked_embed_selectors, + allowed_embed_classnames: embedding.allowed_embed_classnames, + }; + } + + @action + async save(data) { + const embedding = this.adminEmbedding.embedding; + + try { + await embedding.update({ + type: "crawlers", + ...data, + }); + this.toasts.success({ + duration: 1500, + data: { message: i18n("admin.embedding.crawler_settings_saved") }, + }); + } catch (error) { + popupAjaxError(error); + } + } +} diff --git a/app/assets/javascripts/admin/addon/controllers/admin-embedding-index.js b/app/assets/javascripts/admin/addon/controllers/admin-embedding-index.js new file mode 100644 index 00000000000..2e86b8d194b --- /dev/null +++ b/app/assets/javascripts/admin/addon/controllers/admin-embedding-index.js @@ -0,0 +1,43 @@ +import Controller, { inject as controller } from "@ember/controller"; +import { action } from "@ember/object"; +import { alias } from "@ember/object/computed"; +import { service } from "@ember/service"; +import discourseComputed from "discourse-common/utils/decorators"; + +export default class AdminEmbeddingIndexController extends Controller { + @service router; + @service site; + @controller adminEmbedding; + @alias("adminEmbedding.embedding") embedding; + + get showEmbeddingCode() { + return !this.site.isMobileDevice; + } + + @discourseComputed("embedding.base_url") + embeddingCode(baseUrl) { + const html = `
+ + + `; + + return html; + } + + @action + deleteHost(host) { + this.get("embedding.embeddable_hosts").removeObject(host); + } +} diff --git a/app/assets/javascripts/admin/addon/controllers/admin-embedding-posts-and-topics.js b/app/assets/javascripts/admin/addon/controllers/admin-embedding-posts-and-topics.js new file mode 100644 index 00000000000..c57324a2d5e --- /dev/null +++ b/app/assets/javascripts/admin/addon/controllers/admin-embedding-posts-and-topics.js @@ -0,0 +1,46 @@ +import Controller, { inject as controller } from "@ember/controller"; +import { action } from "@ember/object"; +import { service } from "@ember/service"; +import { isEmpty } from "@ember/utils"; +import { popupAjaxError } from "discourse/lib/ajax-error"; +import { i18n } from "discourse-i18n"; + +export default class AdminEmbeddingPostsAndTopicsController extends Controller { + @service toasts; + @controller adminEmbedding; + + get formData() { + const embedding = this.adminEmbedding.embedding; + + return { + embed_by_username: isEmpty(embedding.embed_by_username) + ? null + : [embedding.embed_by_username], + embed_post_limit: embedding.embed_post_limit, + embed_title_scrubber: embedding.embed_title_scrubber, + embed_truncate: embedding.embed_truncate, + embed_unlisted: embedding.embed_unlisted, + }; + } + + @action + async save(data) { + const embedding = this.adminEmbedding.embedding; + + try { + await embedding.update({ + type: "posts_and_topics", + ...data, + embed_by_username: data.embed_by_username[0], + }); + this.toasts.success({ + duration: 1500, + data: { + message: i18n("admin.embedding.posts_and_topics_settings_saved"), + }, + }); + } catch (error) { + popupAjaxError(error); + } + } +} diff --git a/app/assets/javascripts/admin/addon/controllers/admin-embedding-settings.js b/app/assets/javascripts/admin/addon/controllers/admin-embedding-settings.js new file mode 100644 index 00000000000..653926d9686 --- /dev/null +++ b/app/assets/javascripts/admin/addon/controllers/admin-embedding-settings.js @@ -0,0 +1,3 @@ +import AdminAreaSettingsBaseController from "admin/controllers/admin-area-settings-base"; + +export default class AdminEmbeddingSettingsController extends AdminAreaSettingsBaseController {} diff --git a/app/assets/javascripts/admin/addon/controllers/admin-embedding.js b/app/assets/javascripts/admin/addon/controllers/admin-embedding.js index 2fecb6717a0..f8d2954a071 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-embedding.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-embedding.js @@ -1,61 +1,3 @@ import Controller from "@ember/controller"; -import { action } from "@ember/object"; -import { popupAjaxError } from "discourse/lib/ajax-error"; -import discourseComputed from "discourse-common/utils/decorators"; -export default class AdminEmbeddingController extends Controller { - saved = false; - embedding = null; - - // show settings if we have at least one created host - @discourseComputed("embedding.embeddable_hosts.@each.isCreated") - showSecondary() { - const hosts = this.get("embedding.embeddable_hosts"); - return hosts.length && hosts.findBy("isCreated"); - } - - @discourseComputed("embedding.base_url") - embeddingCode(baseUrl) { - const html = `
- - -`; - - return html; - } - - @action - saveChanges() { - const embedding = this.embedding; - const updates = embedding.getProperties(embedding.get("fields")); - - this.set("saved", false); - this.embedding - .update(updates) - .then(() => this.set("saved", true)) - .catch(popupAjaxError); - } - - @action - addHost() { - const host = this.store.createRecord("embeddable-host"); - this.get("embedding.embeddable_hosts").pushObject(host); - } - - @action - deleteHost(host) { - this.get("embedding.embeddable_hosts").removeObject(host); - } -} +export default class AdminEmbeddingController extends Controller {} diff --git a/app/assets/javascripts/admin/addon/routes/admin-embedding-edit.js b/app/assets/javascripts/admin/addon/routes/admin-embedding-edit.js new file mode 100644 index 00000000000..b8dbb630983 --- /dev/null +++ b/app/assets/javascripts/admin/addon/routes/admin-embedding-edit.js @@ -0,0 +1,15 @@ +import DiscourseRoute from "discourse/routes/discourse"; +import { i18n } from "discourse-i18n"; + +export default class AdminEmbeddingEditRoute extends DiscourseRoute { + async model(params) { + const embedding = await this.store.find("embedding"); + return embedding.embeddable_hosts.find( + (host) => host.id === parseInt(params.id, 10) + ); + } + + titleToken() { + return i18n("admin.embedding.host_form.edit_header"); + } +} diff --git a/app/assets/javascripts/admin/addon/routes/admin-embedding-new.js b/app/assets/javascripts/admin/addon/routes/admin-embedding-new.js new file mode 100644 index 00000000000..8edf5bc30b3 --- /dev/null +++ b/app/assets/javascripts/admin/addon/routes/admin-embedding-new.js @@ -0,0 +1,8 @@ +import DiscourseRoute from "discourse/routes/discourse"; +import { i18n } from "discourse-i18n"; + +export default class AdminEmbeddingNewRoute extends DiscourseRoute { + titleToken() { + return i18n("admin.embedding.host_form.add_header"); + } +} diff --git a/app/assets/javascripts/admin/addon/routes/admin-route-map.js b/app/assets/javascripts/admin/addon/routes/admin-route-map.js index ca5bb6edfd7..92f2e4f3bf4 100644 --- a/app/assets/javascripts/admin/addon/routes/admin-route-map.js +++ b/app/assets/javascripts/admin/addon/routes/admin-route-map.js @@ -65,10 +65,21 @@ export default function () { this.route("edit", { path: "/:id" }); } ); - this.route("adminEmbedding", { - path: "/embedding", - resetNamespace: true, - }); + this.route( + "adminEmbedding", + { + path: "/embedding", + resetNamespace: true, + }, + function () { + this.route("index", { path: "/" }); + this.route("settings"); + this.route("postsAndTopics", { path: "/posts_and_topics" }); + this.route("crawlers"); + this.route("new"); + this.route("edit", { path: "/:id" }); + } + ); this.route( "adminCustomizeEmailTemplates", { path: "/email_templates", resetNamespace: true }, diff --git a/app/assets/javascripts/admin/addon/templates/embedding-crawlers.hbs b/app/assets/javascripts/admin/addon/templates/embedding-crawlers.hbs new file mode 100644 index 00000000000..0ebaf30e070 --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/embedding-crawlers.hbs @@ -0,0 +1,32 @@ + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/templates/embedding-edit.hbs b/app/assets/javascripts/admin/addon/templates/embedding-edit.hbs new file mode 100644 index 00000000000..93252280384 --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/embedding-edit.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/templates/embedding-index.hbs b/app/assets/javascripts/admin/addon/templates/embedding-index.hbs new file mode 100644 index 00000000000..a06384aa64f --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/embedding-index.hbs @@ -0,0 +1,49 @@ +{{#if this.embedding.embeddable_hosts}} + {{#if this.showEmbeddingCode}} + + <:content> + {{html-safe (i18n "admin.embedding.sample")}} + + + + {{/if}} + + + + + + + + {{#if this.embedding.embed_by_username}} + + {{else}} + + {{/if}} + + + {{#each this.embedding.embeddable_hosts as |host|}} + + {{/each}} + +
{{i18n "admin.embedding.host"}}{{i18n "admin.embedding.allowed_paths"}}{{i18n "admin.embedding.category"}}{{i18n "admin.embedding.tags"}}{{i18n + "admin.embedding.post_author_with_default" + author=this.embedding.embed_by_username + }}{{i18n "admin.embedding.post_author"}}
+{{else}} + +{{/if}} + + \ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/templates/embedding-new.hbs b/app/assets/javascripts/admin/addon/templates/embedding-new.hbs new file mode 100644 index 00000000000..6a602d64c8d --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/embedding-new.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/templates/embedding-posts-and-topics.hbs b/app/assets/javascripts/admin/addon/templates/embedding-posts-and-topics.hbs new file mode 100644 index 00000000000..614b54b5175 --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/embedding-posts-and-topics.hbs @@ -0,0 +1,53 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/templates/embedding-settings.hbs b/app/assets/javascripts/admin/addon/templates/embedding-settings.hbs new file mode 100644 index 00000000000..4c5a40d01d3 --- /dev/null +++ b/app/assets/javascripts/admin/addon/templates/embedding-settings.hbs @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/templates/embedding.hbs b/app/assets/javascripts/admin/addon/templates/embedding.hbs index b090f37ec77..2efb25bc678 100644 --- a/app/assets/javascripts/admin/addon/templates/embedding.hbs +++ b/app/assets/javascripts/admin/addon/templates/embedding.hbs @@ -1,111 +1,49 @@ -
- {{#if this.embedding.embeddable_hosts}} - - - - - - - {{#if this.embedding.embed_by_username}} - - {{else}} - - {{/if}} - - - - {{#each this.embedding.embeddable_hosts as |host|}} - - {{/each}} - -
{{i18n "admin.embedding.host"}}{{i18n "admin.embedding.allowed_paths"}}{{i18n "admin.embedding.category"}}{{i18n "admin.embedding.tags"}}{{i18n - "admin.embedding.post_author" - author=this.embedding.embed_by_username - }}{{i18n "admin.embedding.post_author"}} 
- {{else}} -

{{i18n "admin.embedding.get_started"}}

- {{/if}} +
+ + <:breadcrumbs> + + + + <:actions as |actions|> + + + <:tabs> + + + + + + - - - -
- -{{#if this.showSecondary}} -
- {{html-safe (i18n "admin.embedding.sample")}} - +
+ {{outlet}}
- -
- -
-

{{i18n "admin.embedding.settings"}}

- - - - - - -
- -
-

{{i18n "admin.embedding.crawling_settings"}}

-

{{i18n "admin.embedding.crawling_description"}}

- - - - - - -
- -
- - - {{#if this.saved}}{{i18n "saved"}}{{/if}} -
-{{/if}} \ No newline at end of file +
\ No newline at end of file diff --git a/app/assets/javascripts/admin/addon/templates/permalinks-index.hbs b/app/assets/javascripts/admin/addon/templates/permalinks-index.hbs index 31e9d14a423..9e6cb6c37c4 100644 --- a/app/assets/javascripts/admin/addon/templates/permalinks-index.hbs +++ b/app/assets/javascripts/admin/addon/templates/permalinks-index.hbs @@ -68,7 +68,7 @@ class="btn-small admin-permalink-item__edit" @route="adminPermalinks.edit" @routeModels={{pl}} - @label="admin.config_areas.flags.edit" + @label="admin.config_areas.permalinks.edit" /> diff --git a/app/assets/javascripts/admin/addon/templates/permalinks.hbs b/app/assets/javascripts/admin/addon/templates/permalinks.hbs index 893db076511..58c1369daff 100644 --- a/app/assets/javascripts/admin/addon/templates/permalinks.hbs +++ b/app/assets/javascripts/admin/addon/templates/permalinks.hbs @@ -16,7 +16,6 @@ @route="adminPermalinks.new" @title="admin.permalink.add" @label="admin.permalink.add" - @icon="plus" class="admin-permalinks__header-add-permalink" /> diff --git a/app/assets/javascripts/discourse/tests/integration/components/admin-config-area-card-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/admin-config-area-card-test.gjs index 5bfa9ec5748..96298a0ef84 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/admin-config-area-card-test.gjs +++ b/app/assets/javascripts/discourse/tests/integration/components/admin-config-area-card-test.gjs @@ -36,6 +36,20 @@ module("Integration | Component | AdminConfigAreaCard", function (hooks) { assert.dom(".admin-config-area-card__content").exists(); }); + test("renders admin config area card with toggle button and collapsed by default", async function (assert) { + await render(); + + assert.dom(".admin-config-area-card__title").exists(); + assert.dom(".admin-config-area-card__toggle-button").exists(); + assert.dom(".admin-config-area-card__content").doesNotExist(); + }); + test("renders admin config area card with header action", async function (assert) { await render(