Make admin open in a new window

This commit is contained in:
Toby Zerner 2015-07-08 10:51:16 +09:30
parent 5e982a39c5
commit 5cfb870202
2 changed files with 8 additions and 2 deletions

View File

@ -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'
})
);
}

View File

@ -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;