mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
Make admin open in a new window
This commit is contained in:
parent
5e982a39c5
commit
5cfb870202
|
@ -5,6 +5,7 @@ import DropdownButton from 'flarum/components/dropdown-button';
|
|||
import ActionButton from 'flarum/components/action-button';
|
||||
import ItemList from 'flarum/utils/item-list';
|
||||
import Separator from 'flarum/components/separator';
|
||||
import Group from 'flarum/models/group';
|
||||
|
||||
export default class UserDropdown extends Component {
|
||||
view() {
|
||||
|
@ -40,12 +41,13 @@ export default class UserDropdown extends Component {
|
|||
})
|
||||
);
|
||||
|
||||
if (user.groups().some((group) => group.id() == 1)) {
|
||||
if (user.groups().some((group) => Number(group.id()) === Group.ADMINISTRATOR_ID)) {
|
||||
items.add('administration',
|
||||
ActionButton.component({
|
||||
icon: 'wrench',
|
||||
label: 'Administration',
|
||||
href: app.forum.attribute('baseUrl')+'/admin'
|
||||
href: app.forum.attribute('baseUrl') + '/admin',
|
||||
target: '_blank'
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -7,4 +7,8 @@ Group.prototype.namePlural = Model.attribute('namePlural');
|
|||
Group.prototype.color = Model.attribute('color');
|
||||
Group.prototype.icon = Model.attribute('icon');
|
||||
|
||||
Group.ADMINISTRATOR_ID = 1;
|
||||
Group.GUEST_ID = 2;
|
||||
Group.MEMBER_ID = 3;
|
||||
|
||||
export default Group;
|
||||
|
|
Loading…
Reference in New Issue
Block a user