2019-02-22 06:17:33 +03:00
|
|
|
import PostsController from './posts';
|
2022-02-01 12:34:03 +03:00
|
|
|
import classic from 'ember-classic-decorator';
|
|
|
|
import {action} from '@ember/object';
|
2019-02-22 06:17:33 +03:00
|
|
|
|
|
|
|
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'
|
|
|
|
}];
|
|
|
|
|
2020-12-04 13:30:03 +03:00
|
|
|
const ORDERS = [{
|
|
|
|
name: 'Newest',
|
|
|
|
value: null
|
|
|
|
}, {
|
|
|
|
name: 'Oldest',
|
|
|
|
value: 'published_at asc'
|
|
|
|
}, {
|
|
|
|
name: 'Recently updated',
|
|
|
|
value: 'updated_at desc'
|
|
|
|
}];
|
|
|
|
|
2019-02-22 06:17:33 +03:00
|
|
|
/* eslint-disable ghost/ember/alias-model-in-controller */
|
2022-02-01 12:34:03 +03:00
|
|
|
@classic
|
|
|
|
export default class PagesController extends PostsController {
|
2019-02-22 06:17:33 +03:00
|
|
|
init() {
|
2022-02-01 12:34:03 +03:00
|
|
|
super.init(...arguments);
|
2019-02-22 06:17:33 +03:00
|
|
|
this.availableTypes = TYPES;
|
2020-12-04 13:30:03 +03:00
|
|
|
this.availableOrders = ORDERS;
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|
2019-02-22 06:17:33 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
@action
|
|
|
|
openEditor(page) {
|
|
|
|
this.transitionToRoute('editor.edit', 'page', page.get('id'));
|
2019-02-22 06:17:33 +03:00
|
|
|
}
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|