Commit 753fd381 authored by Kev's avatar Kev

Simplify 'collapsedWeightLabel' computed value

parent cb449e70
...@@ -66,24 +66,13 @@ export default { ...@@ -66,24 +66,13 @@ export default {
return this.checkIfNoValue(this.weight); return this.checkIfNoValue(this.weight);
}, },
collapsedWeightLabel() { collapsedWeightLabel() {
let label = this.weight; return this.checkIfNoValue(this.weight)
if (this.checkIfNoValue(this.weight)) { ? this.noValueLabel
label = this.noValueLabel; : this.weight.toString().substr(0, 5);
}
// Truncate with ellipsis after five digits
if (this.weight > 99999) {
label = `${this.weight.toString().substr(0, 5)}…`;
}
return label;
}, },
noValueLabel() { noValueLabel() {
return s__('Sidebar|None'); return s__('Sidebar|None');
}, },
changeWeightLabel() {
return s__('Sidebar|Change weight');
},
dropdownToggleLabel() { dropdownToggleLabel() {
let label = this.weight; let label = this.weight;
if (this.checkIfNoValue(this.weight)) { if (this.checkIfNoValue(this.weight)) {
...@@ -166,11 +155,12 @@ export default { ...@@ -166,11 +155,12 @@ export default {
> >
<gl-icon :size="16" name="weight" /> <gl-icon :size="16" name="weight" />
<gl-loading-icon v-if="fetching" class="js-weight-collapsed-loading-icon" /> <gl-loading-icon v-if="fetching" class="js-weight-collapsed-loading-icon" />
<span <span v-else class="js-weight-collapsed-weight-label">
v-else {{ collapsedWeightLabel
v-safe-html="collapsedWeightLabel" }}<template v-if="weight > 99999"
class="js-weight-collapsed-weight-label" >&hellip;</template
></span> >
</span>
</div> </div>
<div class="title hide-collapsed"> <div class="title hide-collapsed">
{{ s__('Sidebar|Weight') }} {{ s__('Sidebar|Weight') }}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment