mirror of
https://github.com/discourse/discourse.git
synced 2025-01-17 04:02:46 +08:00
407fa69778
Conversion of /admin/customize/embedding page to follow admin UX guidelines.
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
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);
|
|
}
|
|
}
|
|
}
|