1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-25 08:09:43 +02:00

Stop search view from messing iwht browser history

Fixes #195

Browser back button functions as expected.

Will go live in v2.0.3.
This commit is contained in:
Harvey Kandola 2019-02-10 16:46:09 +00:00
parent fbe353475c
commit 9504a8cf6c
5 changed files with 60 additions and 21 deletions

View file

@ -13,6 +13,27 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout
import Route from '@ember/routing/route';
export default Route.extend(AuthenticatedRouteMixin, {
matchFilter: null,
beforeModel(transition) {
let matchFilter = {
matchDoc: is.undefined(transition.to.queryParams.matchDoc) ? true : (transition.to.queryParams.matchDoc == 'true'),
matchContent: is.undefined(transition.to.queryParams.matchContent) ? true : (transition.to.queryParams.matchContent == 'true'),
matchTag: is.undefined(transition.to.queryParams.matchTag) ? true : (transition.to.queryParams.matchTag == 'true'),
matchFile: is.undefined(transition.to.queryParams.matchFile) ? true : (transition.to.queryParams.matchFile == 'true'),
slog: is.undefined(transition.to.queryParams.slog) ? false : (transition.to.queryParams.slog === 'true'),
};
this.set('matchFilter', matchFilter);
},
setupController: function (controller, model) {
this._super(controller, model);
controller.set('model', model);
controller.set('matchFilter', this.get('matchFilter'));
},
activate() {
this.get('browser').setTitle('Search');
}