card title: prevent space and no text

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
This commit is contained in:
Jakob Röhrl
2020-09-22 09:09:58 +02:00
committed by Julius Härtl
parent 0d447fff01
commit 7bddcb877c
3 changed files with 12 additions and 3 deletions

View File

@@ -84,8 +84,8 @@
:disabled="stateCardCreating"
:placeholder="t('deck', 'Card name')"
required
pattern=".*\S+.*"
@keydown.esc="stopCardCreation">
<input v-show="!stateCardCreating"
class="icon-confirm"
type="submit"

View File

@@ -227,6 +227,7 @@ import {
getMonthNamesShort,
} from '@nextcloud/l10n'
import moment from '@nextcloud/moment'
import { showError } from '@nextcloud/dialogs'
const markdownIt = new MarkdownIt({
linkify: true,
@@ -464,6 +465,10 @@ export default {
this.descriptionSaving = false
},
updateTitle(newTitle) {
if (newTitle.trim === '') {
showError('Could not update card title')
return
}
this.$set(this.copiedCard, 'title', newTitle)
this.$store.dispatch('updateCardTitle', this.copiedCard).then(() => {
this.titleEditable = false

View File

@@ -43,8 +43,12 @@
class="dragDisabled"
@keyup.esc="cancelEdit"
@submit.prevent="finishedEdit(card)">
<input v-model="copiedCard.title" v-focus type="text">
<input type="button" class="icon-confirm" @click="finishedEdit(card)">
<input v-model="copiedCard.title"
v-focus
type="text"
required
pattern=".*\S+.*">
<input type="submit" value="" class="icon-confirm">
</form>
<DueDate v-if="!editing" :card="card" />