search, filters, links, bug fix, misc, ALPHA
This commit is contained in:
+11
-9
@@ -496,7 +496,7 @@ footer[role="tools"]{
|
|||||||
z-index: 9;
|
z-index: 9;
|
||||||
background-color: $gris;
|
background-color: $gris;
|
||||||
padding:1.2em $side-padding;
|
padding:1.2em $side-padding;
|
||||||
max-height: $list-item-h * 3;
|
max-height: $list-item-h * 5;
|
||||||
@include accordeon-transition($list-item-h * 3);
|
@include accordeon-transition($list-item-h * 3);
|
||||||
>header{
|
>header{
|
||||||
.search-keys{
|
.search-keys{
|
||||||
@@ -538,18 +538,20 @@ footer[role="tools"]{
|
|||||||
article.result.item{
|
article.result.item{
|
||||||
header{
|
header{
|
||||||
h1{
|
h1{
|
||||||
font-size: 0.882em;
|
@include title3black;
|
||||||
font-weight: normal;
|
font-weight: 600;
|
||||||
margin:0 0 0.5em 0;
|
}
|
||||||
|
h2{
|
||||||
|
@include title3black;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.extract{
|
.preview{
|
||||||
p{
|
font-size: 0.882em;
|
||||||
font-size: 0.882em;
|
margin:0;
|
||||||
margin:0;
|
|
||||||
}
|
|
||||||
code{
|
code{
|
||||||
|
@include fontserif;
|
||||||
background-color: lighten(desaturate($rouge,20%), 20%);
|
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++) {
|
for (var i = 0; i < links.length; i++) {
|
||||||
// console.log(`link ${i}:`, links[i])
|
// console.log(`link ${i}:`, links[i])
|
||||||
linkparts = RegExp(/<a class="(.+)" href="(.+)" data-index="(.+)">(.+)<\/a>/g).exec(links[i], 'g')
|
linkparts = RegExp(/<a class="(.+)" href="(.+)" data-index="(.+)">(.+)<\/a>/g).exec(links[i], 'g')
|
||||||
index = linkparts[3]
|
// console.log('linkparts', linkparts)
|
||||||
uuid = linkparts[2].replace('#', '')
|
if (!linkparts) {
|
||||||
newlink = `<a` +
|
console.warn(`link ${i} malformed:`, links[i])
|
||||||
` class="${linkparts[1]} active-link"` +
|
} else {
|
||||||
` data-index="${index}"` +
|
index = linkparts[3]
|
||||||
` data-uuid="${uuid}"` +
|
uuid = linkparts[2].replace('#', '')
|
||||||
` href="/${index}/${uuid}"` +
|
newlink = `<a` +
|
||||||
` @click.prevent="onClickRef"` +
|
` class="${linkparts[1]} active-link"` +
|
||||||
` @keyup.enter="onClickRef"` +
|
` data-index="${index}"` +
|
||||||
` @mouseover="onHoverLink"` +
|
` data-uuid="${uuid}"` +
|
||||||
` @mouseleave="onLeaveLink"` +
|
` href="/${index}/${uuid}"` +
|
||||||
`>${linkparts[4]}` +
|
` @click.prevent="onClickRef"` +
|
||||||
`<sup class="mdi mdi-message-text-outline" />` +
|
` @keyup.enter="onClickRef"` +
|
||||||
`</a>`
|
` @mouseover="onHoverLink"` +
|
||||||
// console.log('newlink', newlink)
|
` @mouseleave="onLeaveLink"` +
|
||||||
this.html = this.html.replace(links[i], newlink)
|
`>${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)
|
// console.log('this.html', this.html)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,22 @@
|
|||||||
<header>
|
<header>
|
||||||
<h1>
|
<h1>
|
||||||
<a
|
<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"
|
@click.prevent="onclick"
|
||||||
@keyup.enter="onclick"
|
@keyup.enter="onclick"
|
||||||
v-html="result.textId"
|
v-html="result.textId"
|
||||||
/>
|
/>
|
||||||
</h1>
|
</h2>
|
||||||
</header>
|
</header>
|
||||||
<div class="extract" v-html="result.extract" />
|
<p v-if="preview" class="preview" v-html="preview" />
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -26,6 +34,17 @@ export default {
|
|||||||
required: true
|
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: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addHistoryItem: 'History/addItem'
|
addHistoryItem: 'History/addItem'
|
||||||
@@ -33,10 +52,6 @@ export default {
|
|||||||
onclick () {
|
onclick () {
|
||||||
console.log('clicked on result item', this.result)
|
console.log('clicked on result item', this.result)
|
||||||
this.addHistoryItem(this.result)
|
this.addHistoryItem(this.result)
|
||||||
// this.$router.push({
|
|
||||||
// name: `item`,
|
|
||||||
// params: { uuid: this.result.uuid }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<header class="col-1">
|
<header class="col-1">
|
||||||
<h2>Resultats</h2>
|
<h2>Resultats</h2>
|
||||||
<span class="search-keys">{{ keys }}</span><br>
|
<span class="search-keys">{{ keys }}</span><br>
|
||||||
<span class="results-count">{{ results.length }} resultat(s)</span>
|
<span class="results-count">{{ resultsCount }}</span>
|
||||||
</header>
|
</header>
|
||||||
<section class="col-10 results-list">
|
<section class="col-10 results-list">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
@@ -48,7 +48,8 @@ export default {
|
|||||||
},
|
},
|
||||||
...mapState({
|
...mapState({
|
||||||
keys: state => state.Search.keys,
|
keys: state => state.Search.keys,
|
||||||
results: state => state.Search.results
|
results: state => state.Search.results,
|
||||||
|
resultsCount: state => state.Search.resultsCount
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="search" class="col-11">
|
<div id="search" class="col-11">
|
||||||
<form class="search-form row">
|
<form class="search-form row">
|
||||||
<fieldset class="search col-3">
|
<fieldset class="search col-2">
|
||||||
<div>
|
<div>
|
||||||
<label for="keys">Search</label>
|
<label for="keys">Search</label>
|
||||||
<input
|
<input
|
||||||
@@ -37,41 +37,41 @@
|
|||||||
title="chargement"
|
title="chargement"
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</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
|
<v-select
|
||||||
id="filters-nominum"
|
id="filters-nominum"
|
||||||
type="select"
|
type="select"
|
||||||
placeholder="filtrer par personne"
|
placeholder="filtrer par personne"
|
||||||
append-to-body
|
append-to-body
|
||||||
:calculate-position="dropDownMenuPos"
|
:calculate-position="dropDownMenuPos"
|
||||||
:options="filtersNominum"
|
:options="personsOptions"
|
||||||
:value="filtersNominumValue"
|
:value="activeFilters.persons"
|
||||||
multiple
|
multiple
|
||||||
@input="onFiltersNominumSelected"
|
@input="onFiltersNominumSelected"
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</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
|
<v-select
|
||||||
id="filters-locorum"
|
id="filters-locorum"
|
||||||
type="select"
|
type="select"
|
||||||
placeholder="filtrer par lieux"
|
placeholder="filtrer par lieux"
|
||||||
append-to-body
|
append-to-body
|
||||||
:calculate-position="dropDownMenuPos"
|
:calculate-position="dropDownMenuPos"
|
||||||
:options="filtersLocorum"
|
:options="placesOptions"
|
||||||
:value="filtersLocorumValue"
|
:value="activeFilters.places"
|
||||||
multiple
|
multiple
|
||||||
@input="onFiltersLocorumSelected"
|
@input="onFiltersLocorumSelected"
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</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
|
<v-select
|
||||||
id="filters-operum"
|
id="filters-operum"
|
||||||
type="select"
|
type="select"
|
||||||
placeholder="filtrer par objet"
|
placeholder="filtrer par objet"
|
||||||
append-to-body
|
append-to-body
|
||||||
:calculate-position="dropDownMenuPos"
|
:calculate-position="dropDownMenuPos"
|
||||||
:options="filtersOperum"
|
:options="objectsOptions"
|
||||||
:value="filtersOperumValue"
|
:value="activeFilters.objects"
|
||||||
multiple
|
multiple
|
||||||
@input="onFiltersOperumSelected"
|
@input="onFiltersOperumSelected"
|
||||||
/>
|
/>
|
||||||
@@ -99,13 +99,18 @@ export default {
|
|||||||
isloading: state => state.Search.isloading,
|
isloading: state => state.Search.isloading,
|
||||||
searchTypeOptions: state => state.Search.searchTypeOptions,
|
searchTypeOptions: state => state.Search.searchTypeOptions,
|
||||||
searchTypeValue: state => state.Search.searchTypeValue,
|
searchTypeValue: state => state.Search.searchTypeValue,
|
||||||
filtersNominum: state => state.Search.filtersNominum,
|
filters: state => state.Search.filters,
|
||||||
filtersLocorum: state => state.Search.filtersLocorum,
|
activeFilters: state => state.Search.activeFilters
|
||||||
filtersOperum: state => state.Search.filtersOperum,
|
}),
|
||||||
filtersNominumValue: state => state.Search.filtersNominumValue,
|
personsOptions () {
|
||||||
filtersLocorumValue: state => state.Search.filtersLocorumValue,
|
return this.filters.persons.filter(option => !this.activeFilters.persons.includes(option))
|
||||||
filtersOperumValue: state => state.Search.filtersOperumValue
|
},
|
||||||
})
|
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: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
@@ -165,15 +170,15 @@ export default {
|
|||||||
},
|
},
|
||||||
onFiltersNominumSelected (e) {
|
onFiltersNominumSelected (e) {
|
||||||
console.log('onFiltersNominumSelected', e)
|
console.log('onFiltersNominumSelected', e)
|
||||||
this.setSearchFiltersValue({ index: 'nominum', value: e })
|
this.setSearchFiltersValue({ index: 'persons', value: e })
|
||||||
},
|
},
|
||||||
onFiltersLocorumSelected (e) {
|
onFiltersLocorumSelected (e) {
|
||||||
console.log('onFiltersLocorumSelected', e)
|
console.log('onFiltersLocorumSelected', e)
|
||||||
this.setSearchFiltersValue({ index: 'locorum', value: e })
|
this.setSearchFiltersValue({ index: 'places', value: e })
|
||||||
},
|
},
|
||||||
onFiltersOperumSelected (e) {
|
onFiltersOperumSelected (e) {
|
||||||
console.log('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('addItem', item)
|
||||||
commit('setOpened', true)
|
commit('setOpened', true)
|
||||||
router.push({
|
router.push({
|
||||||
name: `item`,
|
name: `editiontext`,
|
||||||
params: { uuid: item.uuid }
|
params: {
|
||||||
|
id: item.textId,
|
||||||
|
textid: item.uuid
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
navigateToItem ({ dispatch, commit, state }, item) {
|
navigateToItem ({ dispatch, commit, state }, item) {
|
||||||
console.log('history navigate to item', item, router)
|
console.log('history navigate to item', item, router)
|
||||||
// commit('addItem', item)
|
// commit('addItem', item)
|
||||||
router.push({
|
router.push({
|
||||||
name: `item`,
|
name: `editiontext`,
|
||||||
params: { uuid: item.uuid }
|
params: {
|
||||||
|
id: item.textId,
|
||||||
|
textid: item.uuid
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-55
@@ -14,43 +14,10 @@ export default {
|
|||||||
{ 'code': 'objects', 'label': 'Dans les objets' }
|
{ 'code': 'objects', 'label': 'Dans les objets' }
|
||||||
],
|
],
|
||||||
searchTypeValue: { 'code': 'text', 'label': 'Dans les textes' },
|
searchTypeValue: { 'code': 'text', 'label': 'Dans les textes' },
|
||||||
filtersNominum: [
|
filters: { persons: [], places: [], objects: [] },
|
||||||
{ 'code': '1', 'label': 'filter Nonminum 1' },
|
activeFilters: { persons: [], places: [], objects: [] },
|
||||||
{ '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: [],
|
|
||||||
results: [],
|
results: [],
|
||||||
|
resultsCount: '',
|
||||||
isloading: false,
|
isloading: false,
|
||||||
opened: false
|
opened: false
|
||||||
},
|
},
|
||||||
@@ -66,6 +33,9 @@ export default {
|
|||||||
setResults (state, content) {
|
setResults (state, content) {
|
||||||
state.results = content
|
state.results = content
|
||||||
},
|
},
|
||||||
|
setResultsCount (state, quantity) {
|
||||||
|
state.resultsCount = `${quantity.quantity} ${quantity.unit}`
|
||||||
|
},
|
||||||
setIsloading (state, isloading) {
|
setIsloading (state, isloading) {
|
||||||
state.isloading = isloading
|
state.isloading = isloading
|
||||||
},
|
},
|
||||||
@@ -75,14 +45,45 @@ export default {
|
|||||||
setSearchTypeValue (state, value) {
|
setSearchTypeValue (state, value) {
|
||||||
state.searchTypeValue = value
|
state.searchTypeValue = value
|
||||||
},
|
},
|
||||||
setFiltersNominumValue (state, value) {
|
setFilters (state, filters) {
|
||||||
state.filtersNominumValue = value
|
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) {
|
setActiveFilters (state, filters) {
|
||||||
state.filtersLocorumValue = value
|
// console.log('setActiveFilters', filters)
|
||||||
|
state.activeFilters[filters.index] = filters.value
|
||||||
|
// console.log('state.activeFilters', state.activeFilters)
|
||||||
},
|
},
|
||||||
setFiltersOperumValue (state, value) {
|
resetFiltersValues (state) {
|
||||||
state.filtersOperumValue = value
|
for (var index of ['persons', 'places', 'objects']) {
|
||||||
|
state.activeFilters[index] = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -92,11 +93,14 @@ export default {
|
|||||||
console.log('getResults', state.keys)
|
console.log('getResults', state.keys)
|
||||||
commit('setIsloading', true)
|
commit('setIsloading', true)
|
||||||
let params = {
|
let params = {
|
||||||
search: state.keys
|
search: `${state.keys}`,
|
||||||
|
start: 1,
|
||||||
|
count: 30
|
||||||
}
|
}
|
||||||
if (state.searchTypeValue.code !== 'text') {
|
if (state.searchTypeValue.code !== 'text') {
|
||||||
params.type = state.searchTypeValue.code
|
params.type = state.searchTypeValue.code
|
||||||
}
|
}
|
||||||
|
// if ()
|
||||||
// console.log('Search getResults params', params);
|
// console.log('Search getResults params', params);
|
||||||
let q = qs.stringify(params)
|
let q = qs.stringify(params)
|
||||||
return REST.get(`${window.apipath}/search?` + q)
|
return REST.get(`${window.apipath}/search?` + q)
|
||||||
@@ -105,6 +109,8 @@ export default {
|
|||||||
commit('setIsloading', false)
|
commit('setIsloading', false)
|
||||||
commit('setOpened', true)
|
commit('setOpened', true)
|
||||||
commit('setResults', data.content)
|
commit('setResults', data.content)
|
||||||
|
commit('setResultsCount', data.meta.quantity)
|
||||||
|
commit('setFilters', data.meta.filters)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with search', error)
|
console.warn('Issue with search', error)
|
||||||
@@ -116,18 +122,8 @@ export default {
|
|||||||
commit('setSearchTypeValue', value)
|
commit('setSearchTypeValue', value)
|
||||||
},
|
},
|
||||||
setSearchFiltersValue ({ dispatch, commit, state }, filters) {
|
setSearchFiltersValue ({ dispatch, commit, state }, filters) {
|
||||||
console.log('setSearchFiltersValue', filters)
|
// console.log('setSearchFiltersValue', filters)
|
||||||
switch (filters.index) {
|
commit('setActiveFilters', filters)
|
||||||
case 'nominum':
|
|
||||||
commit('setFiltersNominumValue', filters.value)
|
|
||||||
break
|
|
||||||
case 'locorum':
|
|
||||||
commit('setFiltersLocorumValue', filters.value)
|
|
||||||
break
|
|
||||||
case 'operum':
|
|
||||||
commit('setFiltersOperumValue', filters.value)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user