Merge pull request #4710 from G-Chubinidze/gc_SCI_7195

Text block on step without title in rearrange modal [SCI-7195]
This commit is contained in:
artoscinote 2023-01-24 09:40:33 +01:00 committed by GitHub
commit 87fa3bc9a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,8 +23,8 @@
<div class="step-element-name">
<strong v-if="includeNumbers" class="step-element-number">{{ index + 1 }}</strong>
<i v-if="item.attributes.icon" class="fas" :class="item.attributes.icon"></i>
<span :title="item.attributes.name" v-if="item.attributes.name">{{ item.attributes.name }}</span>
<span v-else class="step-element-name-placeholder">{{ item.attributes.placeholder }}</span>
<span :title="nameWithFallbacks(item)" v-if="nameWithFallbacks(item)">{{ nameWithFallbacks(item) }}</span>
<span :title="item.attributes.placeholder" v-else class="step-element-name-placeholder">{{ item.attributes.placeholder }}</span>
</div>
</div>
</Draggable>
@ -73,6 +73,15 @@
this.$nextTick(() => {
$(this.$refs.modal).modal('hide');
});
},
getTitle(item) {
let $item_html = $(item.attributes.text);
$item_html.remove('table, img');
let str = $item_html.text().trim();
return str.length > 56 ? str.slice(0, 56) + "..." : str;
},
nameWithFallbacks(item) {
return item.attributes.name || this.getTitle(item);
}
}
}