avoid empty names with required

Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
Jakob
2019-08-29 08:39:52 +02:00
parent 1c040d35be
commit 619f70b33b
2 changed files with 4 additions and 22 deletions

View File

@@ -76,8 +76,7 @@ export default {
return { return {
newStackTitle: '', newStackTitle: '',
stack: '', stack: '',
showArchived: false, showArchived: false
missingStackName: t('deck', 'stack title must be provided')
} }
}, },
computed: { computed: {
@@ -90,13 +89,6 @@ export default {
return 'opacity: 1.0' return 'opacity: 1.0'
} }
return 'opacity: 0.3' return 'opacity: 0.3'
},
addNewStackValidation() {
if (this.newStackTitle === '') {
return false
}
return true
} }
}, },
methods: { methods: {

View File

@@ -48,11 +48,9 @@
<label for="new-stack-input-main" class="hidden-visually">Add a new card</label> <label for="new-stack-input-main" class="hidden-visually">Add a new card</label>
<input id="new-stack-input-main" v-model="newCardTitle" type="text" <input id="new-stack-input-main" v-model="newCardTitle" type="text"
class="no-close" class="no-close"
placeholder="Add a new card"> placeholder="Add a new card" required>
<input v-tooltip="{content: missingCardName, show: !addNewCardValidation, trigger: 'manual' }" <input class="icon-confirm"
:disabled="!addNewCardValidation"
class="icon-confirm"
type="submit" type="submit"
value=""> value="">
</form> </form>
@@ -87,20 +85,12 @@ export default {
return { return {
editing: false, editing: false,
copiedStack: '', copiedStack: '',
newCardTitle: '', newCardTitle: ''
missingCardName: t('deck', 'card title must be provided')
} }
}, },
computed: { computed: {
cardsByStack() { cardsByStack() {
return (id) => this.$store.getters.cardsByStack(id) return (id) => this.$store.getters.cardsByStack(id)
},
addNewCardValidation() {
if (this.newCardTitle === '') {
return false
}
return true
} }
}, },