Ghost/ghost/admin/app/controllers/pages.js
Kevin Ansfield ef0178cd06 Refactored posts and pages controllers to Octane patterns
refs https://github.com/TryGhost/Ghost/issues/14101

- migrated to full native class syntax
- removed loading of snippets as they are not needed on post lists (they are needed on the editor screen which does it's own loading)
- removed `access` query param definition leftover from earlier development
- removed use of `{{action}}` in associated templates
2022-10-07 18:39:34 +01:00

44 lines
857 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('editor.edit', 'page', page.get('id'));
}
}