Merge pull request #4314 from Ocelot-Social-Community/4253-long-hashtags-not-visible

fix: 🐛 Fix Wrong Truncation Of Hashtags In Admin List Via Adding 'truncateStr'
This commit is contained in:
Wolfgang Huß 2021-03-30 17:36:54 +02:00 committed by GitHub
commit 8bd34f9de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -5,7 +5,7 @@
<template #index="scope">{{ scope.index + 1 }}.</template>
<template #id="scope">
<nuxt-link :to="{ path: '/', query: { hashtag: encodeURI(scope.row.id) } }">
<b>#{{ scope.row.id | truncate(20) }}</b>
<b>#{{ scope.row.id | truncateStr(20) }}</b>
</nuxt-link>
</template>
</ds-table>

View File

@ -24,6 +24,7 @@ export default ({ app = {} }) => {
}
return accounting.formatNumber(value || 0, precision, thousands, decimals)
},
// doesn't truncate in the middle of words
truncate: (value = '', length = -1) => {
if (!value || typeof value !== 'string' || value.length <= 0) {
return ''
@ -33,6 +34,7 @@ export default ({ app = {} }) => {
}
return trunc(value, length).html
},
// truncates in the middle of words
truncateStr: (value = '', length = -1) => {
if (!value || typeof value !== 'string' || value.length <= 0) {
return ''