1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

Improve permissions page

- Introduce the concept of "required permissions" - basically a permission dependency tree. In order for a group to be granted one permission, they must also have another.
- Improve redraw performance by not building dropdown menu contents until dropdown is opened

ref #904
This commit is contained in:
Toby Zerner
2016-05-27 12:42:19 +09:30
parent 1177880483
commit 240aa9e83b
7 changed files with 257 additions and 115 deletions

26
js/forum/dist/app.js vendored
View File

@@ -21457,13 +21457,18 @@ System.register('flarum/components/Dropdown', ['flarum/Component', 'flarum/helpe
}
babelHelpers.createClass(Dropdown, [{
key: 'init',
value: function init() {
this.showing = false;
}
}, {
key: 'view',
value: function view() {
var items = this.props.children ? listItems(this.props.children) : [];
return m(
'div',
{ className: 'ButtonGroup Dropdown dropdown ' + this.props.className + ' itemCount' + items.length },
{ className: 'ButtonGroup Dropdown dropdown ' + this.props.className + ' itemCount' + items.length + (this.showing ? ' open' : '') },
this.getButton(),
this.getMenu(items)
);
@@ -21479,25 +21484,32 @@ System.register('flarum/components/Dropdown', ['flarum/Component', 'flarum/helpe
// bottom of the viewport. If it does, we will apply class to make it show
// above the toggle button instead of below it.
this.$().on('shown.bs.dropdown', function () {
_this2.showing = true;
if (_this2.props.onshow) {
_this2.props.onshow();
}
m.redraw();
var $menu = _this2.$('.Dropdown-menu');
var isRight = $menu.hasClass('Dropdown-menu--right');
$menu.removeClass('Dropdown-menu--top Dropdown-menu--right');
$menu.toggleClass('Dropdown-menu--top', $menu.offset().top + $menu.height() > $(window).scrollTop() + $(window).height());
$menu.toggleClass('Dropdown-menu--right', isRight || $menu.offset().left + $menu.width() > $(window).scrollLeft() + $(window).width());
if (_this2.props.onshow) {
_this2.props.onshow();
m.redraw();
}
});
this.$().on('hidden.bs.dropdown', function () {
_this2.showing = false;
if (_this2.props.onhide) {
_this2.props.onhide();
m.redraw();
}
m.redraw();
});
}
}, {