mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +03:00
04d9caefed
no issue
Updated settings navigation to a completely redesigned flow for Ghost 4.0 🎉
Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
Co-authored-by: Fabien O'Carroll <fabien@allou.is>
Co-authored-by: Rish <zrishabhgarg@gmail.com>
26 lines
967 B
JavaScript
26 lines
967 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.isOwner'),
|
|
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};
|
|
}
|
|
}); |