diff --git a/app/javascript/vue/protocol/step.vue b/app/javascript/vue/protocol/step.vue index 52ed15158..38d6dbe41 100644 --- a/app/javascript/vue/protocol/step.vue +++ b/app/javascript/vue/protocol/step.vue @@ -44,6 +44,8 @@ :allowBlank="false" :attributeName="`${i18n.t('Step')} ${i18n.t('name')}`" :autofocus="editingName" + :placeholder="i18n.t('protocols.steps.placeholder')" + :defaultValue="i18n.t('protocols.steps.default_name')" @editingEnabled="editingName = true" @editingDisabled="editingName = false" :editOnload="step.newStep == true" diff --git a/app/javascript/vue/shared/inline_edit.vue b/app/javascript/vue/shared/inline_edit.vue index 105f05c30..af15d356e 100644 --- a/app/javascript/vue/shared/inline_edit.vue +++ b/app/javascript/vue/shared/inline_edit.vue @@ -46,7 +46,8 @@ allowNewLine: { type: Boolean, default: false }, multilinePaste: { type: Boolean, default: false }, smartAnnotation: { type: Boolean, default: false }, - editOnload: { type: Boolean, default: false } + editOnload: { type: Boolean, default: false }, + defaultValue: { type: String, default: '' } }, data() { return { @@ -126,6 +127,9 @@ this.editing = true; this.focus(); this.$nextTick(() => { + if (this.$refs.input.value === this.defaultValue) { + this.$refs.input.select(); + } if (this.smartAnnotation) { SmartAnnotation.init($(this.$refs.input)); } diff --git a/config/locales/en.yml b/config/locales/en.yml index 4ed25b874..e446b07a1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2525,6 +2525,7 @@ en: success_flash: 'Protocol %{name} successfully imported to %{type}.' steps: + placeholder: 'Enter step name' default_name: 'Untitled step' completed: 'Completed' uncompleted: 'Uncompleted'