mirror of
https://github.com/flarum/framework.git
synced 2024-11-23 10:32:44 +08:00
Update admin js for new admin UX
This commit is contained in:
parent
86da969449
commit
90120e7bde
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user