mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
88049f1692
refs https://github.com/TryGhost/Team/issues/1136 - adds dropdown for active/archived offers selection - wires active/archived offers on list screen to API - filters offers list on archived/active based on selection
37 lines
922 B
JavaScript
37 lines
922 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;
|
|
|
|
queryParams = {
|
|
type: {refreshModel: true}
|
|
};
|
|
|
|
// 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'
|
|
};
|
|
}
|
|
}
|