mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
31e4b77525
refs https://github.com/TryGhost/Team/issues/1084 refs https://github.com/TryGhost/Team/issues/1085 - adds model/validator/config and router for offers - updates template for offer list and detail with dynamic values - updated route handling for offer list and creation - wires offer data from API to list and detail pages
33 lines
859 B
JavaScript
33 lines
859 B
JavaScript
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class offersRoute extends AuthenticatedRoute {
|
|
@service store;
|
|
@service feature;
|
|
|
|
// redirect to posts screen if:
|
|
// - TODO: members is disabled?
|
|
// - logged in user isn't owner/admin
|
|
beforeModel() {
|
|
super.beforeModel(...arguments);
|
|
if (!this.session.user.isAdmin) {
|
|
return this.transitionTo('home');
|
|
}
|
|
}
|
|
|
|
model(params) {
|
|
return this.controllerFor('offers').fetchOffersTask.perform(params);
|
|
}
|
|
|
|
// trigger a background load of members plus labels for filter dropdown
|
|
setupController() {
|
|
super.setupController(...arguments);
|
|
}
|
|
|
|
buildRouteInfoMetadata() {
|
|
return {
|
|
titleToken: 'Offers'
|
|
};
|
|
}
|
|
}
|