Skip to content
Snippets Groups Projects

Add truncation to work item description

1 unresolved thread
Compare and Show latest version
4 files
+ 41
6
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -13,6 +13,7 @@ export default {
@@ -13,6 +13,7 @@ export default {
components: {
components: {
GlButton,
GlButton,
},
},
 
inject: ['workItemsMvc2'],
props: {
props: {
disableTruncation: {
disableTruncation: {
type: Boolean,
type: Boolean,
@@ -56,7 +57,7 @@ export default {
@@ -56,7 +57,7 @@ export default {
return this.canEdit && !this.disableInlineEditing;
return this.canEdit && !this.disableInlineEditing;
},
},
isTruncated() {
isTruncated() {
return this.truncated && !this.disableTruncation;
return this.truncated && !this.disableTruncation && this.workItemsMvc2;
},
},
},
},
watch: {
watch: {
@@ -69,7 +70,16 @@ export default {
@@ -69,7 +70,16 @@ export default {
},
},
mounted() {
mounted() {
this.$nextTick(() => {
this.$nextTick(() => {
this.truncated = this.$refs['gfm-content'].clientHeight > 420;
const windowHeight = document.documentElement.clientHeight * 0.4;
 
let maxHeight;
 
if (windowHeight > 512) {
 
maxHeight = 512;
 
} else if (windowHeight < 256) {
 
maxHeight = 256;
 
} else {
 
maxHeight = windowHeight;
 
}
 
this.truncated = this.$refs['gfm-content'].clientHeight > maxHeight;
});
});
},
},
methods: {
methods: {
@@ -158,12 +168,11 @@ export default {
@@ -158,12 +168,11 @@ export default {
@change="toggleCheckboxes"
@change="toggleCheckboxes"
></div>
></div>
<div v-if="isTruncated" class="description-more gl-display-block gl-w-full">
<div v-if="isTruncated" class="description-more gl-display-block gl-w-full">
<div class="description-scrim"></div>
<div class="show-all-btn gl-w-full gl--flex-center">
<div class="show-all-btn gl-w-full gl-bg-white gl--flex-center">
<gl-button
<gl-button
variant="confirm"
variant="confirm"
category="tertiary"
category="tertiary"
class="gl-bg-white gl-mx-4"
class="gl-mx-4"
data-testid="show-all-btn"
data-testid="show-all-btn"
@click="showAll"
@click="showAll"
>{{ __('Show all') }}</gl-button
>{{ __('Show all') }}</gl-button
Loading