mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 02:34:05 +08:00
`discourse-common` was created in the past to share logic between the 'wizard' app and the main 'discourse' app. Since then, the wizard has been consolidated into the main app, so the separation of `discourse-common` is no longer useful. This commit moves `discourse-common/(lib|utils)/*` into `discourse/lib/*`, adds shims for the imports, and updates existing uses in core.
43 lines
1.3 KiB
JavaScript
Vendored
43 lines
1.3 KiB
JavaScript
Vendored
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/lib/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 = `<div id='discourse-comments'></div>
|
|
<meta name='discourse-username' content='DISCOURSE_USERNAME'>
|
|
|
|
<script type="text/javascript">
|
|
DiscourseEmbed = {
|
|
discourseUrl: '${baseUrl}/',
|
|
discourseEmbedUrl: 'EMBED_URL',
|
|
// className: 'CLASS_NAME',
|
|
};
|
|
|
|
(function() {
|
|
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
|
|
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
|
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
|
|
})();
|
|
</script>`;
|
|
|
|
return html;
|
|
}
|
|
|
|
@action
|
|
deleteHost(host) {
|
|
this.get("embedding.embeddable_hosts").removeObject(host);
|
|
}
|
|
}
|