Ghost/ghost/admin/app/components/gh-nav-menu/footer.js
Thibaut Patel dc9c812d9c Renamed isAdmin/isOwner/isAdminOrOwner to reduce confusion
issue https://github.com/TryGhost/Team/issues/857

- The goal is to avoid testing for the owner role only is cases where we should be testing for the owner or admin role
- `isOwner` => `isOwnerOnly`
- `isAdmin` => `isAdminOnly`
- `isOwnerOrAdmin` => `isAdmin` (concerns now both Owner and Admins)
2021-07-12 14:55:56 +02:00

27 lines
972 B
JavaScript

import Component from '@ember/component';
import calculatePosition from 'ember-basic-dropdown/utils/calculate-position';
import {and, match} from '@ember/object/computed';
import {inject as service} from '@ember/service';
export default Component.extend({
config: service(),
session: service(),
router: service(),
whatsNew: service(),
feature: service(),
showDropdownExtension: and('config.clientExtensions.dropdown', 'session.user.isOwnerOnly'),
isSettingsRoute: match('router.currentRouteName', /^settings/),
// equivalent to "left: auto; right: -20px"
userDropdownPosition(trigger, dropdown) {
let {horizontalPosition, verticalPosition, style} = calculatePosition(...arguments);
let {width: dropdownWidth} = dropdown.firstElementChild.getBoundingClientRect();
style.right += (dropdownWidth - 20);
style['z-index'] = '1100';
return {horizontalPosition, verticalPosition, style};
}
});