mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
2a77c0fe51
no issue - list custom post views in collapsable sidebar navigation - default views: Draft, Scheduled, Published (except for contributors) - record expanded/collapsed state of the navigation menus in user settings via new `navigation` service - adds `customViews` service that manages custom views - provides list of default views - gives access to "active" custom view based on current route and query params - manages loading/saving of custom views to user settings - show "Add view" button in the content filter when the posts list has been filtered - show "Edit view" button in the content filter when the posts list filter matches a saved view Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
/* eslint-disable ghost/ember/alias-model-in-controller */
|
|
import Controller from '@ember/controller';
|
|
import {computed} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default Controller.extend({
|
|
customViews: service(),
|
|
dropdown: service(),
|
|
router: service(),
|
|
session: service(),
|
|
settings: service(),
|
|
ui: service(),
|
|
|
|
showNavMenu: computed('router.currentRouteName', 'session.{isAuthenticated,user.isFulfilled}', 'ui.isFullScreen', function () {
|
|
let {router, session, ui} = this;
|
|
|
|
// if we're in fullscreen mode don't show the nav menu
|
|
if (ui.isFullScreen) {
|
|
return false;
|
|
}
|
|
|
|
// we need to defer showing the navigation menu until the session.user
|
|
// promise has fulfilled so that gh-user-can-admin has the correct data
|
|
if (!session.isAuthenticated || !session.user.isFulfilled) {
|
|
return false;
|
|
}
|
|
|
|
return (router.currentRouteName !== 'error404' || session.isAuthenticated)
|
|
&& !router.currentRouteName.match(/(signin|signup|setup|reset)/);
|
|
})
|
|
});
|