Fix selected default step title and step name placeholder [SCI-7067] (#4326)

* Fix selected default step title in edit mode and step name placeholder [SCI-7067]

* Add new placeholder label [SCI-7067]
This commit is contained in:
ajugo 2022-08-08 16:50:34 +02:00 committed by GitHub
parent 6bfb25ba50
commit 1ee091aa53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -44,6 +44,8 @@
:allowBlank="false" :allowBlank="false"
:attributeName="`${i18n.t('Step')} ${i18n.t('name')}`" :attributeName="`${i18n.t('Step')} ${i18n.t('name')}`"
:autofocus="editingName" :autofocus="editingName"
:placeholder="i18n.t('protocols.steps.placeholder')"
:defaultValue="i18n.t('protocols.steps.default_name')"
@editingEnabled="editingName = true" @editingEnabled="editingName = true"
@editingDisabled="editingName = false" @editingDisabled="editingName = false"
:editOnload="step.newStep == true" :editOnload="step.newStep == true"

View file

@ -46,7 +46,8 @@
allowNewLine: { type: Boolean, default: false }, allowNewLine: { type: Boolean, default: false },
multilinePaste: { type: Boolean, default: false }, multilinePaste: { type: Boolean, default: false },
smartAnnotation: { type: Boolean, default: false }, smartAnnotation: { type: Boolean, default: false },
editOnload: { type: Boolean, default: false } editOnload: { type: Boolean, default: false },
defaultValue: { type: String, default: '' }
}, },
data() { data() {
return { return {
@ -126,6 +127,9 @@
this.editing = true; this.editing = true;
this.focus(); this.focus();
this.$nextTick(() => { this.$nextTick(() => {
if (this.$refs.input.value === this.defaultValue) {
this.$refs.input.select();
}
if (this.smartAnnotation) { if (this.smartAnnotation) {
SmartAnnotation.init($(this.$refs.input)); SmartAnnotation.init($(this.$refs.input));
} }

View file

@ -2525,6 +2525,7 @@ en:
success_flash: 'Protocol <strong>%{name}</strong> successfully imported to %{type}.' success_flash: 'Protocol <strong>%{name}</strong> successfully imported to %{type}.'
steps: steps:
placeholder: 'Enter step name'
default_name: 'Untitled step' default_name: 'Untitled step'
completed: 'Completed' completed: 'Completed'
uncompleted: 'Uncompleted' uncompleted: 'Uncompleted'