mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +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:
parent
fbe353475c
commit
9504a8cf6c
5 changed files with 60 additions and 21 deletions
|
@ -14,12 +14,11 @@ import Controller from '@ember/controller';
|
|||
|
||||
export default Controller.extend({
|
||||
appMeta: service(),
|
||||
|
||||
queryParams: ['filter', 'matchDoc', 'matchContent', 'matchTag', 'matchFile', 'slog'],
|
||||
filter: '',
|
||||
matchDoc: true,
|
||||
matchContent: true,
|
||||
matchTag: true,
|
||||
matchFile: true,
|
||||
slog: false,
|
||||
slog: false
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
<div class="title">Match Filter</div>
|
||||
<div class="list">
|
||||
<div class="item">
|
||||
{{input id="search-1" type="checkbox" checked=matchDoc}}
|
||||
{{input id="search-1" type="checkbox" checked=matchFilter.matchDoc}}
|
||||
<label for="search-1" class="name">Document name</label>
|
||||
</div>
|
||||
<div class="item">
|
||||
{{input id="search-2" type="checkbox" checked=matchContent}}
|
||||
{{input id="search-2" type="checkbox" checked=matchFilter.matchContent}}
|
||||
<label for="search-2" class="name">Document content</label>
|
||||
</div>
|
||||
<div class="item">
|
||||
{{input id="search-3" type="checkbox" checked=matchTag}}
|
||||
{{input id="search-3" type="checkbox" checked=matchFilter.matchTag}}
|
||||
<label for="search-3" class="name">Tag name</label>
|
||||
</div>
|
||||
<div class="item">
|
||||
{{input id="search-4" type="checkbox" checked=matchFile}}
|
||||
{{input id="search-4" type="checkbox" checked=matchFilter.matchFile}}
|
||||
<label for="search-4" class="name">Attachment name</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -69,9 +69,5 @@
|
|||
|
||||
{{search/search-view
|
||||
filter=filter
|
||||
matchDoc=matchDoc
|
||||
matchContent=matchContent
|
||||
matchTag=matchTag
|
||||
matchFile=matchFile
|
||||
slog=slog}}
|
||||
matchFilter=matchFilter}}
|
||||
{{/layout/master-content}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue