Update admin js for new admin UX

This commit is contained in:
Alexander Skvortsov 2020-11-25 01:08:43 -05:00
parent 86da969449
commit 90120e7bde

View File

@ -1,9 +1,8 @@
import { extend } from 'flarum/extend';
import app from 'flarum/app';
import PermissionGrid from 'flarum/components/PermissionGrid';
app.initializers.add('flarum-approval', () => {
extend(app, 'getRequiredPermissions', function(required, permission) {
extend(app, 'getRequiredPermissions', function (required, permission) {
if (permission === 'discussion.startWithoutApproval') {
required.push('startDiscussion');
}
@ -12,27 +11,21 @@ app.initializers.add('flarum-approval', () => {
}
});
extend(PermissionGrid.prototype, 'startItems', items => {
items.add('startDiscussionsWithoutApproval', {
app.extensionData
.for('flarum-approval')
.registerPermission({
icon: 'fas fa-check',
label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),
permission: 'discussion.startWithoutApproval'
}, 95);
});
extend(PermissionGrid.prototype, 'replyItems', items => {
items.add('replyWithoutApproval', {
}, 'start', 95)
.registerPermission({
icon: 'fas fa-check',
label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),
permission: 'discussion.replyWithoutApproval'
}, 95);
});
extend(PermissionGrid.prototype, 'moderateItems', items => {
items.add('approvePosts', {
}, 'reply', 95)
.registerPermission({
icon: 'fas fa-check',
label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),
permission: 'discussion.approvePosts'
}, 65);
});
}, 'moderate', 65);
});