From 9a5c4628a7824f1f9640b4dba015fbeb7fbce610 Mon Sep 17 00:00:00 2001 From: rmmayo Date: Tue, 25 Jun 2024 15:24:16 +0000 Subject: [PATCH] #2490 - added SkillNameRouterLink.vue for long skill names in skills table --- .../src/components/quiz/QuizDefinitions.vue | 2 +- .../components/skills/SkillNameRouterLink.vue | 71 +++++++++++++++++++ .../src/components/skills/SkillsTable.vue | 21 +++--- .../components/skills/selfReport/ShowMore.vue | 2 +- e2e-tests/cypress/e2e/skills_spec.js | 2 +- 5 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 dashboard-prime/src/components/skills/SkillNameRouterLink.vue diff --git a/dashboard-prime/src/components/quiz/QuizDefinitions.vue b/dashboard-prime/src/components/quiz/QuizDefinitions.vue index 9f2ba5d98c..70a708c1cd 100644 --- a/dashboard-prime/src/components/quiz/QuizDefinitions.vue +++ b/dashboard-prime/src/components/quiz/QuizDefinitions.vue @@ -250,7 +250,7 @@ defineExpose({ outlined size="small"/> - + + +import { computed, onMounted, ref } from 'vue'; +import StringHighlighter from '@/common-components/utilities/StringHighlighter.js'; + +const props = defineProps({ + skill: Object, + subjectId: String, + filterValue: String, + limit: { + type: Number, + required: false, + default: 45, + }, +}); + +const slop = ref(15); +const displayFullText = ref(false); + +onMounted(() => { + displayFullText.value = props.skill.name.length < props.limit + slop.value; +}); + +const truncate = computed(() => { + return props.skill.name.length >= props.limit + slop.value; +}); + +const toDisplay = computed(() => { + if (displayFullText.value) { + return `${props.skill.name}`; + } + return `${props.skill.name.substring(0, props.limit)}`; +}); + +const highlightedValue = computed(() => { + const value = toDisplay.value; + const filterValue = props.filterValue ? props.filterValue.trim() : ''; + if (filterValue && filterValue.length > 0) { + const highlighted = StringHighlighter.highlight(value, filterValue); + return highlighted || value; + } else { + return value; + } +}); + + + + + + \ No newline at end of file diff --git a/dashboard-prime/src/components/skills/SkillsTable.vue b/dashboard-prime/src/components/skills/SkillsTable.vue index f8d408ea59..92aad0a763 100644 --- a/dashboard-prime/src/components/skills/SkillsTable.vue +++ b/dashboard-prime/src/components/skills/SkillsTable.vue @@ -46,6 +46,7 @@ import RemoveSkillTagDialog from '@/components/skills/tags/RemoveSkillTagDialog. import SkillsDataTable from '@/components/utils/table/SkillsDataTable.vue' import { useLog } from '@/components/utils/misc/useLog.js' import { useAppConfig } from '@/common-components/stores/UseAppConfig.js'; +import SkillNameRouterLink from '@/components/skills/SkillNameRouterLink.vue'; const YEARLY = 'YEARLY'; const MONTHLY = 'MONTHLY'; @@ -553,16 +554,11 @@ const isLoading = computed(() => { :value="slotProps.data.name" :filter="filters.global.value" /> -
- - - +
+
+ +
{ {{ tag.tagValue }}
-
-
-
+
+
{