diff --git a/app/controllers/docs/docs_controller.rb b/app/controllers/docs/docs_controller.rb index 50aa76e..4f261fa 100644 --- a/app/controllers/docs/docs_controller.rb +++ b/app/controllers/docs/docs_controller.rb @@ -18,7 +18,7 @@ module Docs page: params[:page], } - query = Docs::Query.new(current_user, filters).list + query = Docs::Query.new(guardian, filters).list if filters[:topic].present? begin diff --git a/assets/javascripts/discourse/components/docs-topic-list-item.js b/assets/javascripts/discourse/components/docs-topic-list-item.js new file mode 100644 index 0000000..327ec72 --- /dev/null +++ b/assets/javascripts/discourse/components/docs-topic-list-item.js @@ -0,0 +1,24 @@ +import Component from "@ember/component"; +import { RUNTIME_OPTIONS } from "discourse-common/lib/raw-handlebars-helpers"; +import { findRawTemplate } from "discourse-common/lib/raw-templates"; +import { htmlSafe } from "@ember/template"; + +export default Component.extend({ + tagName: "tr", + classNameBindings: [":topic-list-item"], + + didInsertElement() { + this._super(...arguments); + this.renderTopicListItem(); + }, + + renderTopicListItem() { + const template = findRawTemplate("docs-topic-list-item"); + if (template) { + this.set( + "topicListItemContents", + htmlSafe(template(this, RUNTIME_OPTIONS)) + ); + } + }, +}); diff --git a/assets/javascripts/discourse/controllers/docs-index.js b/assets/javascripts/discourse/controllers/docs-index.js index 39fe0cd..69985ba 100644 --- a/assets/javascripts/discourse/controllers/docs-index.js +++ b/assets/javascripts/discourse/controllers/docs-index.js @@ -48,6 +48,7 @@ export default Controller.extend({ categories: readOnly("model.categories"), topics: alias("model.topics.topic_list.topics"), tags: readOnly("model.tags"), + showExcerpts: readOnly("model.meta.show_topic_excerpts"), tagGroups: readOnly("model.tag_groups"), topicCount: alias("model.topic_count"), emptyResults: equal("topicCount", 0), @@ -68,6 +69,7 @@ export default Controller.extend({ }, }); }, + @discourseComputed("categories", "categorySort", "categoryFilter") sortedCategories(categories, categorySort, filter) { let { type, direction } = categorySort; diff --git a/assets/javascripts/discourse/templates/components/docs-topic-list-item.hbs b/assets/javascripts/discourse/templates/components/docs-topic-list-item.hbs new file mode 100644 index 0000000..87721b9 --- /dev/null +++ b/assets/javascripts/discourse/templates/components/docs-topic-list-item.hbs @@ -0,0 +1 @@ +{{this.topicListItemContents}} \ No newline at end of file diff --git a/assets/javascripts/discourse/templates/components/docs-topic-list.hbs b/assets/javascripts/discourse/templates/components/docs-topic-list.hbs index 4b50238..0945f3f 100644 --- a/assets/javascripts/discourse/templates/components/docs-topic-list.hbs +++ b/assets/javascripts/discourse/templates/components/docs-topic-list.hbs @@ -28,7 +28,11 @@
{{#each topics as |topic|}} - {{raw "docs-topic-list-item" topic=topic urlPath=urlPath}} + {{docs-topic-list-item + topic=topic + urlPath=urlPath + showExcerpt=showExcerpts + }} {{/each}} diff --git a/assets/javascripts/discourse/templates/docs-index.hbs b/assets/javascripts/discourse/templates/docs-index.hbs index 46e4003..cd82aa7 100644 --- a/assets/javascripts/discourse/templates/docs-index.hbs +++ b/assets/javascripts/discourse/templates/docs-index.hbs @@ -36,7 +36,9 @@ {{#if categories}}