Use checklist checkbox for the custom field checkbox

This commit is contained in:
John R. Supplee 2021-01-19 15:28:01 +02:00
parent b9338a78f4
commit f476143e92
4 changed files with 18 additions and 28 deletions

View file

@ -53,23 +53,12 @@ template(name="cardCustomField-number")
= value
template(name="cardCustomField-checkbox")
if canModifyCard
+inlinedForm(classNames="js-card-customfield-checkbox")
input.materialCheckBox(type="checkbox" checked=data.value)
.edit-controls.clearfix
button.primary(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form
.js-checklist-item.checklist-item(class="{{#if data.value }}is-checked{{/if}}")
if canModifyCard
.check-box-container
.check-box.materialCheckBox(class="{{#if data.value }}is-checked{{/if}}")
else
a.js-open-inlined-form.checkbox-display
if value
i.fa.fa-check-square
else
i.fa.fa-square
else
if value
i.fa.fa-check-square
else
i.fa.fa-square
.materialCheckBox(class="{{#if data.value }}is-checked{{/if}}")
template(name="cardCustomField-currency")
if canModifyCard

View file

@ -86,18 +86,14 @@ CardCustomField.register('cardCustomField');
super.onCreated();
}
isNull() {
return !this.data().value;
toggleItem() {
this.card.setCustomField(this.customFieldId, !this.data().value);
}
events() {
return [
{
'submit .js-card-customfield-checkbox'(event) {
event.preventDefault();
const value = this.find('input').checked;
this.card.setCustomField(this.customFieldId, value);
},
'click .js-checklist-item .check-box-container': this.toggleItem,
},
];
}

View file

@ -8,3 +8,8 @@ template(name="dateBadge")
time(datetime="{{showISODate}}")
| {{showDate}}
template(name="dateCustomField")
a(title="{{showTitle}}" class="{{classes}}")
time(datetime="{{showISODate}}")
| {{showDate}}

View file

@ -242,11 +242,11 @@ textarea
margin: 3px 4px
// Material Design checkboxes
//[type="checkbox"]:not(:checked),
//[type="checkbox"]:checked
// position: absolute
// left: -9999px
// visibility: hidden
[type="checkbox"]:not(:checked),
[type="checkbox"]:checked
position: absolute
left: -9999px
visibility: hidden
.materialCheckBox
position: relative