2021-01-28 18:25:21 +03:00
|
|
|
import Component from '@ember/component';
|
2023-01-06 15:44:27 +03:00
|
|
|
import ThemeErrorsModal from '../modals/design/theme-errors';
|
2021-01-28 18:25:21 +03:00
|
|
|
import calculatePosition from 'ember-basic-dropdown/utils/calculate-position';
|
2022-02-01 12:34:03 +03:00
|
|
|
import classic from 'ember-classic-decorator';
|
2023-01-05 13:34:58 +03:00
|
|
|
import {action} from '@ember/object';
|
2021-01-28 18:25:21 +03:00
|
|
|
import {and, match} from '@ember/object/computed';
|
2022-11-03 14:14:36 +03:00
|
|
|
import {inject} from 'ghost-admin/decorators/inject';
|
2021-01-28 18:25:21 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@classic
|
|
|
|
export default class Footer extends Component {
|
2022-02-01 20:03:45 +03:00
|
|
|
@service session;
|
|
|
|
@service router;
|
|
|
|
@service whatsNew;
|
|
|
|
@service feature;
|
2023-01-05 13:34:58 +03:00
|
|
|
@service modals;
|
2023-01-06 15:44:27 +03:00
|
|
|
@service themeManagement;
|
2022-02-01 12:34:03 +03:00
|
|
|
|
2022-11-03 14:14:36 +03:00
|
|
|
@inject config;
|
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@and('config.clientExtensions.dropdown', 'session.user.isOwnerOnly')
|
2022-02-10 13:41:36 +03:00
|
|
|
showDropdownExtension;
|
2022-02-01 12:34:03 +03:00
|
|
|
|
|
|
|
@match('router.currentRouteName', /^settings/)
|
2022-02-10 13:41:36 +03:00
|
|
|
isSettingsRoute;
|
2021-01-28 18:25:21 +03:00
|
|
|
|
2023-01-05 13:34:58 +03:00
|
|
|
@action
|
|
|
|
openThemeErrors() {
|
2023-01-06 15:44:27 +03:00
|
|
|
this.advancedModal = this.modals.open(ThemeErrorsModal, {
|
|
|
|
title: 'Theme errors',
|
|
|
|
canActivate: false,
|
|
|
|
// Warnings will only be set for developers, otherwise it will always be empty
|
|
|
|
warnings: this.themeManagement.activeTheme.warnings,
|
2023-02-28 16:28:32 +03:00
|
|
|
errors: this.themeManagement.activeTheme.gscanErrors
|
2023-01-06 15:44:27 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
get hasThemeErrors() {
|
2023-02-28 16:28:32 +03:00
|
|
|
return this.themeManagement.activeTheme && this.themeManagement.activeTheme.gscanErrors.length;
|
2023-01-05 13:34:58 +03:00
|
|
|
}
|
|
|
|
|
2021-01-28 18:25:21 +03:00
|
|
|
// 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};
|
|
|
|
}
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|