FEATURE: Show topic title and category in site title (#25)
This commit is contained in:
parent
0d396f921e
commit
a82db01108
|
@ -1,7 +1,8 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import I18n from "I18n";
|
||||
import KnowledgeExplorer from "discourse/plugins/discourse-knowledge-explorer/discourse/models/knowledge-explorer";
|
||||
|
||||
export default Route.extend({
|
||||
export default DiscourseRoute.extend({
|
||||
queryParams: {
|
||||
ascending: { refreshModel: true },
|
||||
filterCategories: { refreshModel: true },
|
||||
|
@ -22,6 +23,20 @@ export default Route.extend({
|
|||
});
|
||||
},
|
||||
|
||||
titleToken() {
|
||||
const model = this.currentModel;
|
||||
const pageTitle = I18n.t("knowledge_explorer.title");
|
||||
if (model.topic.title && model.topic.category_id) {
|
||||
const categoryName = this.site.categories.findBy(
|
||||
"id",
|
||||
model.topic.category_id
|
||||
).name;
|
||||
return `${model.topic.unicode_title} - ${categoryName} - ${pageTitle}`;
|
||||
} else {
|
||||
return pageTitle;
|
||||
}
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set("topic", model.topic);
|
||||
controller.set("model", model);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
|
||||
export default Route.extend({});
|
||||
export default DiscourseRoute.extend({});
|
||||
|
|
Loading…
Reference in New Issue