1
0
mirror of https://github.com/flarum/core.git synced 2025-08-24 09:03:05 +02:00

Add class to IndexPage when viewing a tag

This commit is contained in:
Toby Zerner
2017-10-25 20:23:06 +10:30
parent e85f4122ee
commit e3e7da3f52
2 changed files with 16 additions and 0 deletions

View File

@@ -150,6 +150,14 @@ System.register('flarum/tags/addTagFilter', ['flarum/extend', 'flarum/components
return original();
});
extend(IndexPage.prototype, 'view', function (vdom) {
var tag = this.currentTag();
if (tag) {
vdom.attrs.className += ' IndexPage--tag' + tag.id();
}
});
// If currently viewing a tag, restyle the 'new discussion' button to use
// the tag's color.
extend(IndexPage.prototype, 'sidebarItems', function (items) {

View File

@@ -20,6 +20,14 @@ export default function() {
return original();
});
extend(IndexPage.prototype, 'view', function(vdom) {
const tag = this.currentTag();
if (tag) {
vdom.attrs.className += ' IndexPage--tag'+tag.id();
}
});
// If currently viewing a tag, restyle the 'new discussion' button to use
// the tag's color.
extend(IndexPage.prototype, 'sidebarItems', function(items) {