search, filters, links, bug fix, misc, ALPHA
This commit is contained in:
@@ -57,22 +57,27 @@ export default {
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
// console.log(`link ${i}:`, links[i])
|
||||
linkparts = RegExp(/<a class="(.+)" href="(.+)" data-index="(.+)">(.+)<\/a>/g).exec(links[i], 'g')
|
||||
index = linkparts[3]
|
||||
uuid = linkparts[2].replace('#', '')
|
||||
newlink = `<a` +
|
||||
` class="${linkparts[1]} active-link"` +
|
||||
` data-index="${index}"` +
|
||||
` data-uuid="${uuid}"` +
|
||||
` href="/${index}/${uuid}"` +
|
||||
` @click.prevent="onClickRef"` +
|
||||
` @keyup.enter="onClickRef"` +
|
||||
` @mouseover="onHoverLink"` +
|
||||
` @mouseleave="onLeaveLink"` +
|
||||
`>${linkparts[4]}` +
|
||||
`<sup class="mdi mdi-message-text-outline" />` +
|
||||
`</a>`
|
||||
// console.log('newlink', newlink)
|
||||
this.html = this.html.replace(links[i], newlink)
|
||||
// console.log('linkparts', linkparts)
|
||||
if (!linkparts) {
|
||||
console.warn(`link ${i} malformed:`, links[i])
|
||||
} else {
|
||||
index = linkparts[3]
|
||||
uuid = linkparts[2].replace('#', '')
|
||||
newlink = `<a` +
|
||||
` class="${linkparts[1]} active-link"` +
|
||||
` data-index="${index}"` +
|
||||
` data-uuid="${uuid}"` +
|
||||
` href="/${index}/${uuid}"` +
|
||||
` @click.prevent="onClickRef"` +
|
||||
` @keyup.enter="onClickRef"` +
|
||||
` @mouseover="onHoverLink"` +
|
||||
` @mouseleave="onLeaveLink"` +
|
||||
`>${linkparts[4]}` +
|
||||
`<sup class="mdi mdi-message-text-outline" />` +
|
||||
`</a>`
|
||||
// console.log('newlink', newlink)
|
||||
this.html = this.html.replace(links[i], newlink)
|
||||
}
|
||||
}
|
||||
// console.log('this.html', this.html)
|
||||
}
|
||||
|
||||
@@ -3,14 +3,22 @@
|
||||
<header>
|
||||
<h1>
|
||||
<a
|
||||
:href="result.url"
|
||||
:href="'/edition/'+result.textId+'/'+result.uuid"
|
||||
@click.prevent="onclick"
|
||||
@keyup.enter="onclick"
|
||||
v-html="result.title[0]"
|
||||
/>
|
||||
</h1>
|
||||
<h2>
|
||||
<a
|
||||
:href="'/edition/'+result.textId+'/'+result.uuid"
|
||||
@click.prevent="onclick"
|
||||
@keyup.enter="onclick"
|
||||
v-html="result.textId"
|
||||
/>
|
||||
</h1>
|
||||
</h2>
|
||||
</header>
|
||||
<div class="extract" v-html="result.extract" />
|
||||
<p v-if="preview" class="preview" v-html="preview" />
|
||||
</article>
|
||||
</template>
|
||||
|
||||
@@ -26,6 +34,17 @@ export default {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
preview: ''
|
||||
}),
|
||||
created () {
|
||||
if (this.result.extract) {
|
||||
const subString = this.result.extract.substr(0, 80)
|
||||
this.preview = subString.substr(0, subString.lastIndexOf(' ')) + ' …'
|
||||
} else {
|
||||
console.warn(`No extract for ${this.result.textId}/${this.result.uuid}`)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
addHistoryItem: 'History/addItem'
|
||||
@@ -33,10 +52,6 @@ export default {
|
||||
onclick () {
|
||||
console.log('clicked on result item', this.result)
|
||||
this.addHistoryItem(this.result)
|
||||
// this.$router.push({
|
||||
// name: `item`,
|
||||
// params: { uuid: this.result.uuid }
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<header class="col-1">
|
||||
<h2>Resultats</h2>
|
||||
<span class="search-keys">{{ keys }}</span><br>
|
||||
<span class="results-count">{{ results.length }} resultat(s)</span>
|
||||
<span class="results-count">{{ resultsCount }}</span>
|
||||
</header>
|
||||
<section class="col-10 results-list">
|
||||
<div class="wrapper">
|
||||
@@ -48,7 +48,8 @@ export default {
|
||||
},
|
||||
...mapState({
|
||||
keys: state => state.Search.keys,
|
||||
results: state => state.Search.results
|
||||
results: state => state.Search.results,
|
||||
resultsCount: state => state.Search.resultsCount
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="search" class="col-11">
|
||||
<form class="search-form row">
|
||||
<fieldset class="search col-3">
|
||||
<fieldset class="search col-2">
|
||||
<div>
|
||||
<label for="keys">Search</label>
|
||||
<input
|
||||
@@ -37,41 +37,41 @@
|
||||
title="chargement"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset v-if="filtersNominum.length" class="filters filters-nominum col-3">
|
||||
<fieldset v-if="filters.persons.length" class="filters filters-nominum col-2">
|
||||
<v-select
|
||||
id="filters-nominum"
|
||||
type="select"
|
||||
placeholder="filtrer par personne"
|
||||
append-to-body
|
||||
:calculate-position="dropDownMenuPos"
|
||||
:options="filtersNominum"
|
||||
:value="filtersNominumValue"
|
||||
:options="personsOptions"
|
||||
:value="activeFilters.persons"
|
||||
multiple
|
||||
@input="onFiltersNominumSelected"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset v-if="filtersLocorum.length" class="filters filters-locorum col-3">
|
||||
<fieldset v-if="filters.places.length" class="filters filters-locorum col-2">
|
||||
<v-select
|
||||
id="filters-locorum"
|
||||
type="select"
|
||||
placeholder="filtrer par lieux"
|
||||
append-to-body
|
||||
:calculate-position="dropDownMenuPos"
|
||||
:options="filtersLocorum"
|
||||
:value="filtersLocorumValue"
|
||||
:options="placesOptions"
|
||||
:value="activeFilters.places"
|
||||
multiple
|
||||
@input="onFiltersLocorumSelected"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset v-if="filtersOperum.length" class="filters filters-operum col-3">
|
||||
<fieldset v-if="filters.objects.length" class="filters filters-operum col-2">
|
||||
<v-select
|
||||
id="filters-operum"
|
||||
type="select"
|
||||
placeholder="filtrer par objet"
|
||||
append-to-body
|
||||
:calculate-position="dropDownMenuPos"
|
||||
:options="filtersOperum"
|
||||
:value="filtersOperumValue"
|
||||
:options="objectsOptions"
|
||||
:value="activeFilters.objects"
|
||||
multiple
|
||||
@input="onFiltersOperumSelected"
|
||||
/>
|
||||
@@ -99,13 +99,18 @@ export default {
|
||||
isloading: state => state.Search.isloading,
|
||||
searchTypeOptions: state => state.Search.searchTypeOptions,
|
||||
searchTypeValue: state => state.Search.searchTypeValue,
|
||||
filtersNominum: state => state.Search.filtersNominum,
|
||||
filtersLocorum: state => state.Search.filtersLocorum,
|
||||
filtersOperum: state => state.Search.filtersOperum,
|
||||
filtersNominumValue: state => state.Search.filtersNominumValue,
|
||||
filtersLocorumValue: state => state.Search.filtersLocorumValue,
|
||||
filtersOperumValue: state => state.Search.filtersOperumValue
|
||||
})
|
||||
filters: state => state.Search.filters,
|
||||
activeFilters: state => state.Search.activeFilters
|
||||
}),
|
||||
personsOptions () {
|
||||
return this.filters.persons.filter(option => !this.activeFilters.persons.includes(option))
|
||||
},
|
||||
placesOptions () {
|
||||
return this.filters.places.filter(option => !this.activeFilters.places.includes(option))
|
||||
},
|
||||
objectsOptions () {
|
||||
return this.filters.objects.filter(option => !this.activeFilters.objects.includes(option))
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
@@ -165,15 +170,15 @@ export default {
|
||||
},
|
||||
onFiltersNominumSelected (e) {
|
||||
console.log('onFiltersNominumSelected', e)
|
||||
this.setSearchFiltersValue({ index: 'nominum', value: e })
|
||||
this.setSearchFiltersValue({ index: 'persons', value: e })
|
||||
},
|
||||
onFiltersLocorumSelected (e) {
|
||||
console.log('onFiltersLocorumSelected', e)
|
||||
this.setSearchFiltersValue({ index: 'locorum', value: e })
|
||||
this.setSearchFiltersValue({ index: 'places', value: e })
|
||||
},
|
||||
onFiltersOperumSelected (e) {
|
||||
console.log('onFiltersOperumSelected', e)
|
||||
this.setSearchFiltersValue({ index: 'operum', value: e })
|
||||
this.setSearchFiltersValue({ index: 'objects', value: e })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user