1
0
mirror of https://github.com/flarum/core.git synced 2025-07-23 09:41:26 +02:00

Discussion list refactor, gestures

Also make base Component class automatically assign this.element :)
This commit is contained in:
Toby Zerner
2015-06-24 17:56:39 +09:30
parent 748abd9b0b
commit 972bd24c7a
8 changed files with 328 additions and 144 deletions

View File

@@ -18,14 +18,6 @@ export default class Component {
return selector ? $(this.element()).find(selector) : $(this.element());
}
onload(element) {
this.element(element);
}
config() {
}
/**
*/
@@ -38,13 +30,12 @@ export default class Component {
component.props = props;
var vdom = component.view();
vdom.attrs = vdom.attrs || {};
if (!vdom.attrs.config) {
vdom.attrs.config = function() {
var args = [].slice.apply(arguments);
if (!args[1]) {
component.onload.apply(component, args);
}
component.config.apply(component, args);
var oldConfig = vdom.attrs.config;
vdom.attrs.config = function() {
var args = [].slice.apply(arguments);
component.element(args[0]);
if (oldConfig) {
oldConfig.apply(component, args);
}
}
return vdom;

View File

@@ -10,7 +10,7 @@ export default class DropdownButton extends Component {
'data-toggle': 'dropdown',
onclick: this.props.buttonClick
}, this.props.buttonContent || [
icon((this.props.icon || 'ellipsis-v')+' icon-glyph'),
icon((this.props.icon || 'ellipsis-v')+' icon-glyph icon'),
m('span.label', this.props.label || 'Controls'),
icon('caret-down icon-caret')
]),