Compare commits
1
Commits
fca4be3155
...
54e7e28046
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54e7e28046 |
+2
-2
File diff suppressed because one or more lines are too long
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
Binary file not shown.
-2
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
-1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
+2
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
+1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
@@ -51,7 +51,8 @@ export default {
|
|||||||
count: state => state.Search.count,
|
count: state => state.Search.count,
|
||||||
noresults: state => state.Search.noresults,
|
noresults: state => state.Search.noresults,
|
||||||
limit: state => state.Search.limit,
|
limit: state => state.Search.limit,
|
||||||
searchId: state => state.Search.searchId
|
searchId: state => state.Search.searchId,
|
||||||
|
keys: state => state.Search.keys
|
||||||
}),
|
}),
|
||||||
// items is a sparse array (pages placed by offset); drop the holes left by
|
// items is a sparse array (pages placed by offset); drop the holes left by
|
||||||
// pages that returned fewer results than the limit before rendering.
|
// pages that returned fewer results than the limit before rendering.
|
||||||
@@ -59,7 +60,23 @@ export default {
|
|||||||
return this.items.filter(Boolean)
|
return this.items.filter(Boolean)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// Title of the browser tab: the phrase searched (F3).
|
||||||
|
metaInfo () {
|
||||||
|
return {
|
||||||
|
title: this.keys && this.keys.length ? this.keys.join(', ') : 'Base'
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// terms of an URL: a JSON list, possibly malformed in an old or edited
|
||||||
|
// link; never break the page for it (F3).
|
||||||
|
parseTerms (value) {
|
||||||
|
try {
|
||||||
|
const terms = JSON.parse(value)
|
||||||
|
return Array.isArray(terms) ? terms : []
|
||||||
|
} catch (e) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
...mapActions({
|
...mapActions({
|
||||||
newSearch: 'Search/newSearch',
|
newSearch: 'Search/newSearch',
|
||||||
nextPage: 'Search/nextPage'
|
nextPage: 'Search/nextPage'
|
||||||
@@ -87,7 +104,7 @@ export default {
|
|||||||
if (params.has('terms')) {
|
if (params.has('terms')) {
|
||||||
console.log('Base created, has terms', params.get('terms'))
|
console.log('Base created, has terms', params.get('terms'))
|
||||||
// this.$store.commit('Search/setTerms', params.get('terms').split(','))
|
// this.$store.commit('Search/setTerms', params.get('terms').split(','))
|
||||||
this.$store.commit('Search/setTerms', JSON.parse(params.get('terms')))
|
this.$store.commit('Search/setTerms', this.parseTerms(params.get('terms')))
|
||||||
} else {
|
} else {
|
||||||
this.$store.commit('Search/reSetTerms')
|
this.$store.commit('Search/reSetTerms')
|
||||||
}
|
}
|
||||||
@@ -105,7 +122,7 @@ export default {
|
|||||||
// to.query.terms is a raw JSON string (see SearchForm.submit) and must be
|
// to.query.terms is a raw JSON string (see SearchForm.submit) and must be
|
||||||
// parsed like in created(), otherwise getResults() double-encodes it and
|
// parsed like in created(), otherwise getResults() double-encodes it and
|
||||||
// the backend silently drops the terms (less relevant results).
|
// the backend silently drops the terms (less relevant results).
|
||||||
this.$store.commit('Search/setTerms', JSON.parse(to.query.terms))
|
this.$store.commit('Search/setTerms', this.parseTerms(to.query.terms))
|
||||||
}else{
|
}else{
|
||||||
this.$store.commit('Search/reSetTerms')
|
this.$store.commit('Search/reSetTerms')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user