diff --git a/.discourse-compatibility b/.discourse-compatibility
new file mode 100644
index 0000000..c1a2cfb
--- /dev/null
+++ b/.discourse-compatibility
@@ -0,0 +1 @@
+2.8.0.beta9: 05678c451caf2ceb192501da91cf0d24ea44c8e8
\ No newline at end of file
diff --git a/assets/javascripts/discourse/controllers/docs-index.js.es6 b/assets/javascripts/discourse/controllers/docs-index.js.es6
index 9cf09d1..b78893c 100644
--- a/assets/javascripts/discourse/controllers/docs-index.js.es6
+++ b/assets/javascripts/discourse/controllers/docs-index.js.es6
@@ -4,6 +4,8 @@ import { action } from "@ember/object";
import { alias, equal, gt, readOnly } from "@ember/object/computed";
import Docs from "discourse/plugins/discourse-docs/discourse/models/docs";
import { getOwner } from "@ember/application";
+import getURL from "discourse-common/lib/get-url";
+import I18n from "I18n";
const SHOW_FILTER_AT = 10;
@@ -156,7 +158,7 @@ export default Controller.extend({
},
@discourseComputed("topics", "isSearching", "filterSolved")
- emptyTopics(topics, isSearching, filterSolved) {
+ noContent(topics, isSearching, filterSolved) {
const filtered = isSearching || filterSolved;
return this.topicCount === 0 && !filtered;
},
@@ -194,6 +196,53 @@ export default Controller.extend({
return this.siteSettings.tagging_enabled;
},
+ @discourseComputed()
+ emptyState() {
+ let body = I18n.t("docs.no_docs.body");
+ if (this.docsCategoriesAndTags.length) {
+ body += I18n.t("docs.no_docs.to_include_topic_in_docs");
+ body += ` (${this.docsCategoriesAndTags.join(", ")}).`;
+ } else if (this.currentUser.staff) {
+ const setUpPluginMessage = I18n.t("docs.no_docs.setup_the_plugin", {
+ settingsUrl: getURL(
+ "/admin/site_settings/category/plugins?filter=plugin:discourse-docs"
+ ),
+ });
+ body += ` ${setUpPluginMessage}`;
+ }
+
+ return {
+ title: I18n.t("docs.no_docs.title"),
+ body: body.htmlSafe(),
+ };
+ },
+
+ @discourseComputed("docsCategories", "docsTags")
+ docsCategoriesAndTags(docsCategories, docsTags) {
+ return docsCategories.concat(docsTags);
+ },
+
+ @discourseComputed()
+ docsCategories() {
+ if (!this.siteSettings.docs_categories) {
+ return [];
+ }
+
+ return this.siteSettings.docs_categories.split("|").map((c) => {
+ const id = parseInt(c, 10);
+ return this.site.categories.findBy("id", id).name;
+ });
+ },
+
+ @discourseComputed()
+ docsTags() {
+ if (!this.siteSettings.docs_tags) {
+ return [];
+ }
+
+ return this.siteSettings.docs_tags.split("|").map((t) => `#${t}`);
+ },
+
@action
toggleCategorySort(newType) {
let { type, direction } = this.categorySort;
diff --git a/assets/javascripts/discourse/templates/docs-index.hbs b/assets/javascripts/discourse/templates/docs-index.hbs
index 10cc018..ba287c0 100644
--- a/assets/javascripts/discourse/templates/docs-index.hbs
+++ b/assets/javascripts/discourse/templates/docs-index.hbs
@@ -1,6 +1,9 @@
{{#conditional-loading-spinner condition=isLoading}}
- {{#if emptyTopics}}
- {{html-safe (i18n "docs.no_topics")}}
+ {{#if noContent}}
+