mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 23:29:57 +08:00
Replace Ember app with Mithril app
This commit is contained in:
19
js/lib/components/badge.js
Normal file
19
js/lib/components/badge.js
Normal file
@ -0,0 +1,19 @@
|
||||
import Component from 'flarum/component';
|
||||
import icon from 'flarum/helpers/icon';
|
||||
|
||||
export default class Badge extends Component {
|
||||
view(ctrl) {
|
||||
var iconName = this.props.icon;
|
||||
var label = this.props.title = this.props.label;
|
||||
delete this.props.icon, this.props.label;
|
||||
this.props.config = function(element) {
|
||||
$(element).tooltip();
|
||||
};
|
||||
this.props.className = 'badge '+(this.props.className || '');
|
||||
|
||||
return m('span', this.props, [
|
||||
icon(iconName+' icon-glyph'),
|
||||
m('span.label', label)
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user