Bladeren bron

Use checklist checkbox for the custom field checkbox

John R. Supplee 4 jaren geleden
bovenliggende
commit
f476143e92

+ 5 - 16
client/components/cards/cardCustomFields.jade

@@ -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
-    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
+  .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
-      i.fa.fa-square
+      .materialCheckBox(class="{{#if data.value }}is-checked{{/if}}")
 
 template(name="cardCustomField-currency")
     if canModifyCard

+ 3 - 7
client/components/cards/cardCustomFields.js

@@ -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,
       },
     ];
   }

+ 5 - 0
client/components/cards/cardDate.jade

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

+ 5 - 5
client/components/forms/forms.styl

@@ -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