search, filters, links, bug fix, misc, ALPHA
This commit is contained in:
+11
-9
@@ -496,7 +496,7 @@ footer[role="tools"]{
|
||||
z-index: 9;
|
||||
background-color: $gris;
|
||||
padding:1.2em $side-padding;
|
||||
max-height: $list-item-h * 3;
|
||||
max-height: $list-item-h * 5;
|
||||
@include accordeon-transition($list-item-h * 3);
|
||||
>header{
|
||||
.search-keys{
|
||||
@@ -538,18 +538,20 @@ footer[role="tools"]{
|
||||
article.result.item{
|
||||
header{
|
||||
h1{
|
||||
font-size: 0.882em;
|
||||
font-weight: normal;
|
||||
margin:0 0 0.5em 0;
|
||||
@include title3black;
|
||||
font-weight: 600;
|
||||
}
|
||||
h2{
|
||||
@include title3black;
|
||||
}
|
||||
}
|
||||
.extract{
|
||||
p{
|
||||
font-size: 0.882em;
|
||||
margin:0;
|
||||
}
|
||||
.preview{
|
||||
font-size: 0.882em;
|
||||
margin:0;
|
||||
code{
|
||||
@include fontserif;
|
||||
background-color: lighten(desaturate($rouge,20%), 20%);
|
||||
padding:0 0.2em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,16 +30,22 @@ export default {
|
||||
commit('addItem', item)
|
||||
commit('setOpened', true)
|
||||
router.push({
|
||||
name: `item`,
|
||||
params: { uuid: item.uuid }
|
||||
name: `editiontext`,
|
||||
params: {
|
||||
id: item.textId,
|
||||
textid: item.uuid
|
||||
}
|
||||
})
|
||||
},
|
||||
navigateToItem ({ dispatch, commit, state }, item) {
|
||||
console.log('history navigate to item', item, router)
|
||||
// commit('addItem', item)
|
||||
router.push({
|
||||
name: `item`,
|
||||
params: { uuid: item.uuid }
|
||||
name: `editiontext`,
|
||||
params: {
|
||||
id: item.textId,
|
||||
textid: item.uuid
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+51
-55
@@ -14,43 +14,10 @@ export default {
|
||||
{ 'code': 'objects', 'label': 'Dans les objets' }
|
||||
],
|
||||
searchTypeValue: { 'code': 'text', 'label': 'Dans les textes' },
|
||||
filtersNominum: [
|
||||
{ 'code': '1', 'label': 'filter Nonminum 1' },
|
||||
{ 'code': '2', 'label': 'filter Nonminum 2' },
|
||||
{ 'code': '3', 'label': 'filter Nonminum 3' },
|
||||
{ 'code': '4', 'label': 'filter Nonminum 4' },
|
||||
{ 'code': '5', 'label': 'filter Nonminum 5' },
|
||||
{ 'code': '6', 'label': 'filter Nonminum 6' },
|
||||
{ 'code': '7', 'label': 'filter Nonminum 7' },
|
||||
{ 'code': '8', 'label': 'filter Nonminum 8' },
|
||||
{ 'code': '9', 'label': 'filter Nonminum 9' }
|
||||
],
|
||||
filtersLocorum: [
|
||||
{ 'code': '1', 'label': 'filter Locorum 1' },
|
||||
{ 'code': '2', 'label': 'filter Locorum 2' },
|
||||
{ 'code': '3', 'label': 'filter Locorum 3' },
|
||||
{ 'code': '4', 'label': 'filter Locorum 4' },
|
||||
{ 'code': '5', 'label': 'filter Locorum 5' },
|
||||
{ 'code': '6', 'label': 'filter Locorum 6' },
|
||||
{ 'code': '7', 'label': 'filter Locorum 7' },
|
||||
{ 'code': '8', 'label': 'filter Locorum 8' },
|
||||
{ 'code': '9', 'label': 'filter Locorum 9' }
|
||||
],
|
||||
filtersOperum: [
|
||||
{ 'code': '1', 'label': 'filter Operum 1' },
|
||||
{ 'code': '2', 'label': 'filter Operum 2' },
|
||||
{ 'code': '3', 'label': 'filter Operum 3' },
|
||||
{ 'code': '4', 'label': 'filter Operum 4' },
|
||||
{ 'code': '5', 'label': 'filter Operum 5' },
|
||||
{ 'code': '6', 'label': 'filter Operum 6' },
|
||||
{ 'code': '7', 'label': 'filter Operum 7' },
|
||||
{ 'code': '8', 'label': 'filter Operum 8' },
|
||||
{ 'code': '9', 'label': 'filter Operum 9' }
|
||||
],
|
||||
filtersNominumValue: [],
|
||||
filtersLocorumValue: [],
|
||||
filtersOperumValue: [],
|
||||
filters: { persons: [], places: [], objects: [] },
|
||||
activeFilters: { persons: [], places: [], objects: [] },
|
||||
results: [],
|
||||
resultsCount: '',
|
||||
isloading: false,
|
||||
opened: false
|
||||
},
|
||||
@@ -66,6 +33,9 @@ export default {
|
||||
setResults (state, content) {
|
||||
state.results = content
|
||||
},
|
||||
setResultsCount (state, quantity) {
|
||||
state.resultsCount = `${quantity.quantity} ${quantity.unit}`
|
||||
},
|
||||
setIsloading (state, isloading) {
|
||||
state.isloading = isloading
|
||||
},
|
||||
@@ -75,14 +45,45 @@ export default {
|
||||
setSearchTypeValue (state, value) {
|
||||
state.searchTypeValue = value
|
||||
},
|
||||
setFiltersNominumValue (state, value) {
|
||||
state.filtersNominumValue = value
|
||||
setFilters (state, filters) {
|
||||
for (let index in filters) {
|
||||
if (filters.hasOwnProperty(index)) {
|
||||
console.log('index', index)
|
||||
if (filters[index]) {
|
||||
if (Array.isArray(filters[index])) {
|
||||
state.filters[index] = []
|
||||
for (var i = 0; i < filters[index].length; i++) {
|
||||
if (filters[index][i].uuid && filters[index][i].title) {
|
||||
state.filters[index].push({
|
||||
code: filters[index][i].uuid,
|
||||
label: filters[index][i].title
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (filters[index].uuid && filters[index].title) {
|
||||
state.filters[index] = [{
|
||||
code: filters[index].uuid,
|
||||
label: filters[index].title
|
||||
}]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
state.filters[index] = []
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('filters', state.filters)
|
||||
},
|
||||
setFiltersLocorumValue (state, value) {
|
||||
state.filtersLocorumValue = value
|
||||
setActiveFilters (state, filters) {
|
||||
// console.log('setActiveFilters', filters)
|
||||
state.activeFilters[filters.index] = filters.value
|
||||
// console.log('state.activeFilters', state.activeFilters)
|
||||
},
|
||||
setFiltersOperumValue (state, value) {
|
||||
state.filtersOperumValue = value
|
||||
resetFiltersValues (state) {
|
||||
for (var index of ['persons', 'places', 'objects']) {
|
||||
state.activeFilters[index] = []
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -92,11 +93,14 @@ export default {
|
||||
console.log('getResults', state.keys)
|
||||
commit('setIsloading', true)
|
||||
let params = {
|
||||
search: state.keys
|
||||
search: `${state.keys}`,
|
||||
start: 1,
|
||||
count: 30
|
||||
}
|
||||
if (state.searchTypeValue.code !== 'text') {
|
||||
params.type = state.searchTypeValue.code
|
||||
}
|
||||
// if ()
|
||||
// console.log('Search getResults params', params);
|
||||
let q = qs.stringify(params)
|
||||
return REST.get(`${window.apipath}/search?` + q)
|
||||
@@ -105,6 +109,8 @@ export default {
|
||||
commit('setIsloading', false)
|
||||
commit('setOpened', true)
|
||||
commit('setResults', data.content)
|
||||
commit('setResultsCount', data.meta.quantity)
|
||||
commit('setFilters', data.meta.filters)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('Issue with search', error)
|
||||
@@ -116,18 +122,8 @@ export default {
|
||||
commit('setSearchTypeValue', value)
|
||||
},
|
||||
setSearchFiltersValue ({ dispatch, commit, state }, filters) {
|
||||
console.log('setSearchFiltersValue', filters)
|
||||
switch (filters.index) {
|
||||
case 'nominum':
|
||||
commit('setFiltersNominumValue', filters.value)
|
||||
break
|
||||
case 'locorum':
|
||||
commit('setFiltersLocorumValue', filters.value)
|
||||
break
|
||||
case 'operum':
|
||||
commit('setFiltersOperumValue', filters.value)
|
||||
break
|
||||
}
|
||||
// console.log('setSearchFiltersValue', filters)
|
||||
commit('setActiveFilters', filters)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user