Ghost/ghost/admin/app/controllers/pages.js
Steve Larson c61c42ce1d
Improved performance loading posts & pages in admin (#20646)
ref 8ea1dfb
ref https://linear.app/tryghost/issue/ONC-111

* undid the reversion for the performance improvements
* built upon new tests for the posts list functionality in admin,
including right click actions
* added tests for pages view in Admin

This was reverted because it broke the Pages list view in Admin, which
is a thin extension of the Posts functionality in admin (route &
controller). That has been fixed and tests added.

This was originally reverted because the changes to improve loading
response times broke right click (bulk) actions in the posts list. This
was not caught because it turned out we had near-zero test coverage of
that part of the codebase. Test coverage has been expanded for the posts
list, and while not comprehensive, is a much better place for us to be
in.
2024-07-29 16:19:28 +00:00

43 lines
864 B
JavaScript

import PostsController from './posts';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
const TYPES = [{
name: 'All pages',
value: null
}, {
name: 'Draft pages',
value: 'draft'
}, {
name: 'Published pages',
value: 'published'
}, {
name: 'Scheduled pages',
value: 'scheduled'
}, {
name: 'Featured pages',
value: 'featured'
}];
const ORDERS = [{
name: 'Newest first',
value: null
}, {
name: 'Oldest first',
value: 'published_at asc'
}, {
name: 'Recently updated',
value: 'updated_at desc'
}];
export default class PagesController extends PostsController {
@service router;
availableTypes = TYPES;
availableOrders = ORDERS;
@action
openEditor(page) {
this.router.transitionTo('lexical-editor.edit', 'page', page.get('id'));
}
}