fix: search results href siteRoot undefined

pull/172/head
NGPixel 7 years ago
parent 6f0898aa8f
commit c51d26a02d

@ -10,7 +10,7 @@
li(v-if='searchres.length === 0') li(v-if='searchres.length === 0')
a: em {{ $t('search.nomatch') }} a: em {{ $t('search.nomatch') }}
li(v-for='sres in searchres', v-bind:class='{ "is-active": searchmovekey === "res." + sres.entryPath }') li(v-for='sres in searchres', v-bind:class='{ "is-active": searchmovekey === "res." + sres.entryPath }')
a(v-bind:href='siteRoot + "/" + sres.entryPath') {{ sres.title }} a(v-bind:href='sres.entryPath') {{ sres.title }}
p.searchresults-label(v-if='searchsuggest.length > 0') {{ $t('search.didyoumean') }} p.searchresults-label(v-if='searchsuggest.length > 0') {{ $t('search.didyoumean') }}
ul.searchresults-list(v-if='searchsuggest.length > 0') ul.searchresults-list(v-if='searchsuggest.length > 0')
li(v-for='sug in searchsuggest', v-bind:class='{ "is-active": searchmovekey === "sug." + sug }') li(v-for='sug in searchsuggest', v-bind:class='{ "is-active": searchmovekey === "sug." + sug }')
@ -39,7 +39,10 @@ export default {
self.searchactive = true self.searchactive = true
self.searchload++ self.searchload++
socket.emit('search', { terms: val }, (data) => { socket.emit('search', { terms: val }, (data) => {
self.searchres = data.match self.searchres = self._.map(data.match, m => {
m.entryPath = `${siteRoot}/${m.entryPath}`
return m
})
self.searchsuggest = data.suggest self.searchsuggest = data.suggest
self.searchmovearr = self._.concat([], self.searchres, self.searchsuggest) self.searchmovearr = self._.concat([], self.searchres, self.searchsuggest)
if (self.searchload > 0) { self.searchload-- } if (self.searchload > 0) { self.searchload-- }
@ -74,7 +77,7 @@ export default {
let i = this.searchmoveidx - 1 let i = this.searchmoveidx - 1
if (this.searchmovearr[i]) { if (this.searchmovearr[i]) {
window.location.assign(siteRoot + '/' + this.searchmovearr[i].entryPath) window.location.assign(this.searchmovearr[i].entryPath)
} else { } else {
this.searchq = this.searchmovearr[i] this.searchq = this.searchmovearr[i]
} }

@ -1,6 +1,6 @@
{ {
"name": "wiki.js", "name": "wiki.js",
"version": "1.0.0-beta.13.1", "version": "1.0.0-beta.14.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"dependencies": { "dependencies": {
"amp": { "amp": {

@ -1,6 +1,6 @@
{ {
"name": "wiki.js", "name": "wiki.js",
"version": "1.0.0-beta.13.2", "version": "1.0.0-beta.14.1",
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "install.js", "main": "install.js",
"scripts": { "scripts": {

@ -1,6 +1,6 @@
{ {
"name": "wiki", "name": "wiki",
"version": "1.0.0-beta.13", "version": "1.0.0-beta.14",
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {

Loading…
Cancel
Save