mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
b5d1d5918c
closes https://github.com/TryGhost/Team/issues/967 Member filters is reset when clicked on "Members" in the left sidebar.
38 lines
947 B
JavaScript
38 lines
947 B
JavaScript
import {helper} from '@ember/component/helper';
|
|
|
|
export const DEFAULT_QUERY_PARAMS = {
|
|
posts: {
|
|
type: null,
|
|
visibility: null,
|
|
author: null,
|
|
tag: null,
|
|
order: null
|
|
},
|
|
pages: {
|
|
type: null,
|
|
visibility: null,
|
|
author: null,
|
|
tag: null,
|
|
order: null
|
|
},
|
|
'members.index': {
|
|
label: null,
|
|
paid: null,
|
|
search: '',
|
|
filter: null,
|
|
order: null
|
|
}
|
|
};
|
|
|
|
// in order to reset query params to their defaults when using <LinkTo> or
|
|
// `transitionTo` it's necessary to explicitly set each param. This helper makes
|
|
// it easier to provide a "resetting" link, especially when used with custom views
|
|
|
|
export function resetQueryParams(routeName, newParams) {
|
|
return Object.assign({}, DEFAULT_QUERY_PARAMS[routeName], newParams);
|
|
}
|
|
|
|
export default helper(function (params/*, hash*/) {
|
|
return resetQueryParams(...params);
|
|
});
|