card and stack names required, clear card field after creation

Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
Jakob
2019-08-28 11:01:36 +02:00
parent 493eee601b
commit 329df8e856
2 changed files with 26 additions and 4 deletions

View File

@@ -42,9 +42,10 @@
<label for="new-stack-input-main" class="hidden-visually">Add a new stack</label>
<input id="new-stack-input-main" v-model="newStackTitle" type="text"
class="no-close"
placeholder="Add a new stack">
placeholder="Add a new stack" required>
<input v-tooltip="t('deck', 'clickAddNewStack')" class="icon-confirm" type="submit"
value="">
</form>
</div>
<div class="board-action-buttons">
@@ -75,7 +76,8 @@ export default {
return {
newStackTitle: '',
stack: '',
showArchived: false
showArchived: false,
missingStackName: t('deck', 'stack title must be provided')
}
},
computed: {
@@ -88,6 +90,13 @@ export default {
return 'opacity: 1.0'
}
return 'opacity: 0.3'
},
addNewStackValidation() {
if (this.newStackTitle === '') {
return false
}
return true
}
},
methods: {

View File

@@ -49,7 +49,11 @@
<input id="new-stack-input-main" v-model="newCardTitle" type="text"
class="no-close"
placeholder="Add a new card">
<input v-tooltip="t('deck', 'Create a new card')" class="icon-confirm" type="submit"
<input v-tooltip="{content: missingCardName, show: !addNewCardValidation, trigger: 'manual' }"
:disabled="!addNewCardValidation"
class="icon-confirm"
type="submit"
value="">
</form>
@@ -83,12 +87,20 @@ export default {
return {
editing: false,
copiedStack: '',
newCardTitle: ''
newCardTitle: '',
missingCardName: t('deck', 'card title must be provided')
}
},
computed: {
cardsByStack() {
return (id) => this.$store.getters.cardsByStack(id)
},
addNewCardValidation() {
if (this.newCardTitle === '') {
return false
}
return true
}
},
@@ -121,6 +133,7 @@ export default {
boardId: this.stack.boardId
}
this.$store.dispatch('addCard', newCard)
this.newCardTitle = ''
}
}
}