Prevent setting a bucket limit < 0

This commit is contained in:
kolaente 2021-04-15 16:58:48 +02:00
parent 03d60d3f11
commit 48fb707032
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -51,16 +51,18 @@
<div class="field has-addons" v-if="showSetLimitInput"> <div class="field has-addons" v-if="showSetLimitInput">
<div class="control"> <div class="control">
<input <input
@change="() => updateBucket(bucket)" @change="() => setBucketLimit(bucket)"
@keyup.enter="() => updateBucket(bucket)" @keyup.enter="() => setBucketLimit(bucket)"
class="input" class="input"
type="number" type="number"
min="0"
v-focus.always v-focus.always
v-model="bucket.limit" v-model="bucket.limit"
/> />
</div> </div>
<div class="control"> <div class="control">
<x-button <x-button
:disabled="bucket.limit < 0"
:icon="['far', 'save']" :icon="['far', 'save']"
:shadow="false" :shadow="false"
/> />
@ -75,7 +77,8 @@
class="dropdown-item" class="dropdown-item"
v-tooltip="'All tasks moved into the done bucket will be marked as done automatically. All tasks marked as done from elsewhere will be moved as well.'" v-tooltip="'All tasks moved into the done bucket will be marked as done automatically. All tasks marked as done from elsewhere will be moved as well.'"
> >
<span class="icon is-small" :class="{'has-text-success': bucket.isDoneBucket}"><icon icon="check-double"/></span> <span class="icon is-small" :class="{'has-text-success': bucket.isDoneBucket}"><icon
icon="check-double"/></span>
Done bucket Done bucket
</a> </a>
<a <a
@ -601,6 +604,13 @@ export default {
this.error(e, this) this.error(e, this)
}) })
}, },
setBucketLimit(bucket) {
if (bucket.limit < 0) {
return
}
this.updateBucket(bucket)
},
shouldAcceptDrop(bucket) { shouldAcceptDrop(bucket) {
return bucket.id === this.sourceBucket || // When dragging from a bucket who has its limit reached, dragging should still be possible return bucket.id === this.sourceBucket || // When dragging from a bucket who has its limit reached, dragging should still be possible
bucket.limit === 0 || // If there is no limit set, dragging & dropping should always work bucket.limit === 0 || // If there is no limit set, dragging & dropping should always work