shortening search result title #1250
This commit is contained in:
@@ -1134,8 +1134,10 @@ footer[role="tools"]{
|
|||||||
article.item{
|
article.item{
|
||||||
h1{
|
h1{
|
||||||
@include title3black;
|
@include title3black;
|
||||||
|
font-size: 0.9em;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
max-width: 95%;
|
max-width: 95%;
|
||||||
|
word-break:normal;
|
||||||
}
|
}
|
||||||
h2{
|
h2{
|
||||||
@include title3black;
|
@include title3black;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
:href="'/texts/'+result.textId+'/'+result.uuid"
|
:href="'/texts/'+result.textId+'/'+result.uuid"
|
||||||
@click.prevent="onclick"
|
@click.prevent="onclick"
|
||||||
@keyup.enter="onclick"
|
@keyup.enter="onclick"
|
||||||
v-html="result.title"
|
v-html="shorted_title"
|
||||||
/>
|
/>
|
||||||
</h1>
|
</h1>
|
||||||
<h2>
|
<h2>
|
||||||
@@ -49,14 +49,21 @@ export default {
|
|||||||
return this.editionsbyuuid[this.result.textId].title
|
return this.editionsbyuuid[this.result.textId].title
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// created () {
|
created () {
|
||||||
|
let max = 40
|
||||||
|
if (this.result.title.length > max) {
|
||||||
|
let subString = this.result.title.substr(0, max)
|
||||||
|
this.shorted_title = subString.substr(0, subString.lastIndexOf(' ')) + ' …'
|
||||||
|
} else {
|
||||||
|
this.shorted_title = this.result.title
|
||||||
|
}
|
||||||
// if (this.result.extract) {
|
// if (this.result.extract) {
|
||||||
// const subString = this.result.extract.substr(0, 80)
|
// const subString = this.result.extract.substr(0, 80)
|
||||||
// this.preview = subString.substr(0, subString.lastIndexOf(' ')) + ' …'
|
// this.preview = subString.substr(0, subString.lastIndexOf(' ')) + ' …'
|
||||||
// } else {
|
// } else {
|
||||||
// console.warn(`No extract for ${this.result.textId}/${this.result.uuid}`)
|
// console.warn(`No extract for ${this.result.textId}/${this.result.uuid}`)
|
||||||
// }
|
// }
|
||||||
// },
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addHistoryItem: 'History/addItem'
|
addHistoryItem: 'History/addItem'
|
||||||
|
|||||||
Reference in New Issue
Block a user