From fb4cb676ac3734a7364bdd2c4fda7b2fc1f0f4e7 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Fri, 17 Jul 2020 19:14:18 +0200 Subject: [PATCH] search, filters, links, bug fix, misc, ALPHA --- assets/css/app.scss | 20 ++--- src/components/Content/EdText.vue | 37 +++++---- src/components/Content/ResultItem.vue | 29 +++++-- src/components/nav/Results.vue | 5 +- src/components/nav/Search.vue | 45 ++++++----- src/store/modules/history.js | 14 +++- src/store/modules/search.js | 106 +++++++++++++------------- 7 files changed, 143 insertions(+), 113 deletions(-) diff --git a/assets/css/app.scss b/assets/css/app.scss index 3f138fe..671d599 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -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; } } } diff --git a/src/components/Content/EdText.vue b/src/components/Content/EdText.vue index 5882794..0761f9e 100644 --- a/src/components/Content/EdText.vue +++ b/src/components/Content/EdText.vue @@ -57,22 +57,27 @@ export default { for (var i = 0; i < links.length; i++) { // console.log(`link ${i}:`, links[i]) linkparts = RegExp(/(.+)<\/a>/g).exec(links[i], 'g') - index = linkparts[3] - uuid = linkparts[2].replace('#', '') - newlink = `${linkparts[4]}` + - `` + - `` - // 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 = `${linkparts[4]}` + + `` + + `` + // console.log('newlink', newlink) + this.html = this.html.replace(links[i], newlink) + } } // console.log('this.html', this.html) } diff --git a/src/components/Content/ResultItem.vue b/src/components/Content/ResultItem.vue index a251801..984b352 100644 --- a/src/components/Content/ResultItem.vue +++ b/src/components/Content/ResultItem.vue @@ -3,14 +3,22 @@

+

+

+ -

+
-
+

@@ -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 } - // }) } } } diff --git a/src/components/nav/Results.vue b/src/components/nav/Results.vue index 3241bf3..ee66886 100644 --- a/src/components/nav/Results.vue +++ b/src/components/nav/Results.vue @@ -8,7 +8,7 @@

Resultats

{{ keys }}
- {{ results.length }} resultat(s) + {{ resultsCount }}
@@ -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: { diff --git a/src/components/nav/Search.vue b/src/components/nav/Search.vue index 9189d85..17bc27c 100644 --- a/src/components/nav/Search.vue +++ b/src/components/nav/Search.vue @@ -1,7 +1,7 @@