mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-16 05:42:13 +08:00
Placeholder text in the "Move to different result" modal dropdown
This commit is contained in:
parent
19026b936d
commit
100fdde5ca
4 changed files with 21 additions and 4 deletions
|
|
@ -90,6 +90,10 @@
|
|||
width: calc(100%);
|
||||
}
|
||||
|
||||
.select__option-placeholder {
|
||||
color: var(--sn-grey);
|
||||
}
|
||||
|
||||
.sn-select__no-options {
|
||||
color: var(--sn-grey);
|
||||
padding: .5em;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<div class="w-full">
|
||||
<Select
|
||||
:value="target"
|
||||
:options="targets"
|
||||
:options="getOptions(targets)"
|
||||
v-bind:disabled="false"
|
||||
@change="setTarget"
|
||||
></Select>
|
||||
|
|
@ -77,6 +77,16 @@
|
|||
},
|
||||
cancel() {
|
||||
$(this.$refs.modal).modal('hide');
|
||||
},
|
||||
getOptions(targets) {
|
||||
const updatedTargets = targets.map(target => {
|
||||
if (target[1] === null) {
|
||||
target[2] = this.i18n.t('protocols.steps.modals.move_element.result.untitled_result');
|
||||
}
|
||||
return target;
|
||||
});
|
||||
|
||||
return updatedTargets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@
|
|||
<template v-if="options.length">
|
||||
<div
|
||||
v-for="option in options"
|
||||
:key="option[0]" @mousedown.prevent.stop="setValue(option[0])"
|
||||
:key="option[0]"
|
||||
@mousedown.prevent.stop="setValue(option[0])"
|
||||
class="sn-select__option"
|
||||
:class="{ 'select__option-placeholder': option[1] === null }"
|
||||
>
|
||||
{{ option[1] }}
|
||||
{{ option[1] || option[2] }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
|
@ -54,7 +56,7 @@
|
|||
computed: {
|
||||
valueLabel() {
|
||||
let option = this.options.find((o) => o[0] === this.value);
|
||||
return option && option[1];
|
||||
return option && (option[1] || option[2]);
|
||||
},
|
||||
focusElement() {
|
||||
return this.$refs.focusElement || this.$scopedSlots.default()[0].context.$refs.focusElement;
|
||||
|
|
|
|||
|
|
@ -3135,6 +3135,7 @@ en:
|
|||
result:
|
||||
title: Move to different result
|
||||
targets_label: Select result
|
||||
untitled_result: Untitled result
|
||||
delete_step:
|
||||
title: 'Delete step'
|
||||
description_1: 'You’re about to delete a whole step from your protocol. It might contain data you don’t want to lose. You won’t be able to get it back.'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue