Discourse论坛搭建 在顶部菜单添加未解决按钮

0
37

我是新手 ,对我来说很有用,来源于官网,感谢原作者。

将JS代码粘贴到CSS / HTML 部分,会在顶层菜单中创建两个附加链接:
类别 未解决

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<script>
Discourse.ExternalNavItem = Discourse.NavItem.extend({
href : function() {
return this.get('href');
}.property('href')
});
 
I18n.translations.en.js.filters.unresolved = { title: "类别", help: "类别" };
I18n.translations.en.js.filters.unresolved = { title: "未解决", help: "未解决的主题" };
 
Discourse.NavItem.reopenClass({
buildList : function(category, args) {
var list = this._super(category, args);
if(!category) {
list.push(Discourse.ExternalNavItem.create({href: '/latest?solved=no', name: 'unresolved'}));
} else {
list.push(Discourse.ExternalNavItem.create({href: '/c/'+category.slug+'?solved=no', name: 'category'}));
}
return list;
}
});
</script>

https://meta.discourse.org/t/adding-unsolved-button-to-top-menu-using-custom-html/59758