Add loading indicator and autofocus
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add new list') }}</label>
|
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add new list') }}</label>
|
||||||
<input id="new-stack-input-main"
|
<input id="new-stack-input-main"
|
||||||
v-model="newStackTitle"
|
v-model="newStackTitle"
|
||||||
|
v-focus
|
||||||
type="text"
|
type="text"
|
||||||
class="no-close"
|
class="no-close"
|
||||||
:placeholder="t('deck', 'List name')"
|
:placeholder="t('deck', 'List name')"
|
||||||
|
|||||||
@@ -51,17 +51,22 @@
|
|||||||
</Actions>
|
</Actions>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form v-if="showAddCard" class="stack--card-add" @submit.prevent="clickAddCard()">
|
<form v-if="showAddCard"
|
||||||
|
class="stack--card-add"
|
||||||
|
:class="{ 'icon-loading-small': stateCardCreating }"
|
||||||
|
@submit.prevent="clickAddCard()">
|
||||||
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
|
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
|
||||||
<input id="new-stack-input-main"
|
<input id="new-stack-input-main"
|
||||||
v-model="newCardTitle"
|
v-model="newCardTitle"
|
||||||
v-focus
|
v-focus
|
||||||
type="text"
|
type="text"
|
||||||
class="no-close"
|
class="no-close"
|
||||||
|
:disabled="stateCardCreating"
|
||||||
placeholder="Add a new card"
|
placeholder="Add a new card"
|
||||||
required>
|
required>
|
||||||
|
|
||||||
<input class="icon-confirm"
|
<input v-show="!stateCardCreating"
|
||||||
|
class="icon-confirm"
|
||||||
type="submit"
|
type="submit"
|
||||||
value="">
|
value="">
|
||||||
</form>
|
</form>
|
||||||
@@ -108,6 +113,7 @@ export default {
|
|||||||
copiedStack: '',
|
copiedStack: '',
|
||||||
newCardTitle: '',
|
newCardTitle: '',
|
||||||
showAddCard: false,
|
showAddCard: false,
|
||||||
|
stateCardCreating: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -160,15 +166,21 @@ export default {
|
|||||||
}
|
}
|
||||||
this.editing = false
|
this.editing = false
|
||||||
},
|
},
|
||||||
clickAddCard() {
|
async clickAddCard() {
|
||||||
const newCard = {
|
this.stateCardCreating = true
|
||||||
title: this.newCardTitle,
|
try {
|
||||||
stackId: this.stack.id,
|
await this.$store.dispatch('addCard', {
|
||||||
boardId: this.stack.boardId,
|
title: this.newCardTitle,
|
||||||
|
stackId: this.stack.id,
|
||||||
|
boardId: this.stack.boardId,
|
||||||
|
})
|
||||||
|
this.newCardTitle = ''
|
||||||
|
this.showAddCard = false
|
||||||
|
} catch (e) {
|
||||||
|
OCP.Toast.error('Could not create card: ' + e.response.data.message)
|
||||||
|
} finally {
|
||||||
|
this.stateCardCreating = false
|
||||||
}
|
}
|
||||||
this.$store.dispatch('addCard', newCard)
|
|
||||||
this.newCardTitle = ''
|
|
||||||
this.showAddCard = false
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -209,11 +221,14 @@ export default {
|
|||||||
|
|
||||||
.stack--card-add {
|
.stack--card-add {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: 3px;
|
margin-bottom: 10px;
|
||||||
margin-right: 3px;
|
box-shadow: 0 0 3px var(--color-box-shadow);
|
||||||
box-shadow: 0 0 3px #aaa;
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin-bottom: 15px;
|
|
||||||
|
&.icon-loading-small:after,
|
||||||
|
&.icon-loading-small-dark:after {
|
||||||
|
margin-left: calc(50% - 25px);
|
||||||
|
}
|
||||||
|
|
||||||
input[type=text] {
|
input[type=text] {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user