deck validation
This commit is contained in:
parent
3bbb949400
commit
8aec2a0b6c
2 changed files with 21 additions and 12 deletions
|
@ -30,7 +30,12 @@
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
</v-container>
|
</v-container>
|
||||||
<DeckEditor v-model="editing" :id="deck.id" :list="deck_list" />
|
<DeckEditor
|
||||||
|
:visible="editing"
|
||||||
|
:id="deck.id"
|
||||||
|
:value="deck_list"
|
||||||
|
@close="editing = false"
|
||||||
|
/>
|
||||||
</v-expansion-panel-content>
|
</v-expansion-panel-content>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<v-container v-if="value">
|
<v-container v-if="visible">
|
||||||
<v-card flat>
|
<v-card flat>
|
||||||
<v-alert :value="count !== 50" type="warning">
|
<v-alert :value="count !== 50" type="warning">
|
||||||
{{ count }} cards detected! (Decks should have exactly 50 cards)
|
{{ count }} cards detected! (Decks should have exactly 50 cards)
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<v-textarea
|
<v-textarea
|
||||||
ref="textarea"
|
ref="textarea"
|
||||||
label="Edit Deck"
|
label="Edit Deck"
|
||||||
:value="list"
|
:value="value"
|
||||||
rows="35"
|
rows="35"
|
||||||
hint="Change card counts and/or serial numbers. Names will be updated accordingly!"
|
hint="Change card counts and/or serial numbers. Names will be updated accordingly!"
|
||||||
style="font-family: monospace"
|
style="font-family: monospace"
|
||||||
|
@ -51,8 +51,8 @@ export default {
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
id: Number,
|
id: Number,
|
||||||
list: String,
|
value: String,
|
||||||
value: Boolean
|
visible: Boolean
|
||||||
},
|
},
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
@ -62,7 +62,15 @@ export default {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
session: () => Cookies.get('session')
|
session: () => Cookies.get('session'),
|
||||||
|
|
||||||
|
new_deck() {
|
||||||
|
try {
|
||||||
|
return this.parse_deck(this.$refs.textarea)
|
||||||
|
} catch (e) {
|
||||||
|
return this.parse_deck(this.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -160,8 +168,7 @@ export default {
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.checked = false
|
this.checked = false
|
||||||
|
this.$emit('close')
|
||||||
this.$emit('input', false)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
|
@ -191,14 +198,11 @@ export default {
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.success) {
|
if (response.data.success) {
|
||||||
|
this.$emit('change', new_deck)
|
||||||
this.close()
|
this.close()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
activated() {
|
|
||||||
console.log('Frosch')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Reference in a new issue