Commit f4e65d80 authored by Jan Beckmann's avatar Jan Beckmann Committed by Phil Hughes

Auto-focus "New epic" text box, fix "Add epic" placeholder

Closes #37005, #37028
parent 56a1cb09
...@@ -4,12 +4,16 @@ import { GlButton } from '@gitlab/ui'; ...@@ -4,12 +4,16 @@ import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import LoadingButton from '~/vue_shared/components/loading_button.vue'; import LoadingButton from '~/vue_shared/components/loading_button.vue';
import autofocusonshow from '~/vue_shared/directives/autofocusonshow';
export default { export default {
components: { components: {
GlButton, GlButton,
LoadingButton, LoadingButton,
}, },
directives: {
autofocusonshow,
},
props: { props: {
alignRight: { alignRight: {
type: Boolean, type: Boolean,
...@@ -38,27 +42,20 @@ export default { ...@@ -38,27 +42,20 @@ export default {
}, },
methods: { methods: {
...mapActions(['setEpicCreateTitle', 'createEpic']), ...mapActions(['setEpicCreateTitle', 'createEpic']),
focusInput() {
this.$nextTick(() => this.$refs.epicTitleInput.focus());
},
}, },
}; };
</script> </script>
<template> <template>
<div class="dropdown epic-create-dropdown"> <div class="dropdown epic-create-dropdown">
<gl-button <gl-button variant="success" class="qa-new-epic-button" data-toggle="dropdown">
variant="success"
class="qa-new-epic-button"
data-toggle="dropdown"
@click="focusInput"
>
{{ __('New epic') }} {{ __('New epic') }}
</gl-button> </gl-button>
<div :class="{ 'dropdown-menu-right': alignRight }" class="dropdown-menu"> <div :class="{ 'dropdown-menu-right': alignRight }" class="dropdown-menu">
<input <input
ref="epicTitleInput" ref="epicTitleInput"
v-model="epicTitle" v-model="epicTitle"
v-autofocusonshow
:disabled="epicCreateInProgress" :disabled="epicCreateInProgress"
:placeholder="__('Title')" :placeholder="__('Title')"
type="text" type="text"
......
...@@ -9,7 +9,7 @@ export const issuableTypesMap = { ...@@ -9,7 +9,7 @@ export const issuableTypesMap = {
export const autoCompleteTextMap = { export const autoCompleteTextMap = {
true: { true: {
[issuableTypesMap.ISSUE]: __(' or <#issue id>'), [issuableTypesMap.ISSUE]: __(' or <#issue id>'),
[issuableTypesMap.EPIC]: __(' or <#epic id>'), [issuableTypesMap.EPIC]: __(' or <&epic id>'),
[issuableTypesMap.MERGE_REQUEST]: __(' or <!merge request id>'), [issuableTypesMap.MERGE_REQUEST]: __(' or <!merge request id>'),
}, },
false: { false: {
......
---
title: Auto-focus title text box when creating new epics
merge_request: 21516
author: Jan Beckmann
type: fixed
...@@ -53,10 +53,10 @@ msgstr "" ...@@ -53,10 +53,10 @@ msgstr ""
msgid " or <!merge request id>" msgid " or <!merge request id>"
msgstr "" msgstr ""
msgid " or <#epic id>" msgid " or <#issue id>"
msgstr "" msgstr ""
msgid " or <#issue id>" msgid " or <&epic id>"
msgstr "" msgstr ""
msgid " or references (e.g. path/to/project!merge_request_id)" msgid " or references (e.g. path/to/project!merge_request_id)"
......
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