mirror of
https://github.com/flarum/core.git
synced 2025-08-01 22:20:21 +02:00
Update for evented API
This commit is contained in:
15
extensions/sticky/js/src/addStickyBadge.js
Normal file
15
extensions/sticky/js/src/addStickyBadge.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { extend } from 'flarum/extend';
|
||||
import Discussion from 'flarum/models/Discussion';
|
||||
import Badge from 'flarum/components/Badge';
|
||||
|
||||
export default function addStickyBadge() {
|
||||
extend(Discussion.prototype, 'badges', function(badges) {
|
||||
if (this.isSticky()) {
|
||||
badges.add('sticky', Badge.component({
|
||||
type: 'sticky',
|
||||
label: app.trans('sticky.stickied'),
|
||||
icon: 'thumb-tack'
|
||||
}), 10);
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user