mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
a7f3eef830
closes https://github.com/TryGhost/Team/issues/965 If there's only one filter row in the members filter builder modal, then clicking on "X" in that row resets the fields instead of removing the complete row and showing empty filter builder
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class MembersRoute extends AuthenticatedRoute {
|
|
@service store;
|
|
@service feature;
|
|
|
|
queryParams = {
|
|
label: {refreshModel: true},
|
|
searchParam: {refreshModel: true, replace: true},
|
|
paidParam: {refreshModel: true},
|
|
orderParam: {refreshModel: true},
|
|
filterParam: {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('members').fetchMembersTask.perform(params);
|
|
}
|
|
|
|
// trigger a background load of members plus labels for filter dropdown
|
|
setupController(controller) {
|
|
super.setupController(...arguments);
|
|
controller.fetchLabelsTask.perform();
|
|
}
|
|
|
|
buildRouteInfoMetadata() {
|
|
if (this.feature.membersFiltering) {
|
|
return {
|
|
titleToken: 'Members',
|
|
mainClasses: ['gh-main-fullwidth']
|
|
|
|
};
|
|
} else {
|
|
return {
|
|
titleToken: 'Members'
|
|
};
|
|
}
|
|
}
|
|
|
|
resetController(controller, isExiting) {
|
|
if (isExiting) {
|
|
controller.reset();
|
|
}
|
|
}
|
|
}
|