Преглед изворни кода

preparation hide checklist-items per card

Martin Filser пре 1 година
родитељ
комит
d949753d54

+ 0 - 16
client/components/cards/checklists.css

@@ -8,20 +8,6 @@ textarea.js-edit-checklist-item {
   resize: none;
   height: 34px;
 }
-.card-details .text-show-at-minicard {
-  width: 350px;
-  text-align: left;
-}
-.minicard .text-show-at-minicard {
-  display: none;
-}
-.text-some-space {
-  width: 20px;
-}
-.text-hide-checked-items {
-  width: 400px;
-  text-align: left;
-}
 .delete-text,
 .js-delete-checklist-item,
 .js-convert-checklist-item-to-card {
@@ -40,8 +26,6 @@ textarea.js-edit-checklist-item {
   display: flex;
   justify-content: space-between;
 }
-
-
 .checklist-progress-bar-container {
   display: flex;
   flex-direction: row;

+ 9 - 22
client/components/cards/checklists.jade

@@ -9,10 +9,18 @@ template(name="checklists")
         else
           a.add-checklist-top.js-open-inlined-form(title="{{_ 'add-checklist'}}")
             i.fa.fa-plus
+    if currentUser.isBoardMember
+      .material-toggle-switch(title="{{_ 'hide-checked-items'}}")
+        //span.toggle-switch-title
+        if hideCheckedItems
+          input.toggle-switch(type="checkbox" id="toggleHideCheckedItemsButton" checked="checked")
+        else
+          input.toggle-switch(type="checkbox" id="toggleHideCheckedItemsButton")
+        label.toggle-label(for="toggleHideCheckedItemsButton")
 
   .card-checklist-items
     each checklist in checklists
-      +checklistDetail(checklist=checklist)
+      +checklistDetail(checklist = checklist)
 
   if canModifyCard
     +inlinedForm(autoclose=false classNames="js-add-checklist" cardId = cardId)
@@ -122,27 +130,6 @@ template(name='checklistItemDetail')
           = item.title
 
 template(name="checklistActionsPopup")
-  if currentUser.isBoardMember
-    span.text-show-at-minicard
-      | {{_ 'show-at-minicard'}}
-    .material-toggle-switch(title="{{_ 'show-checklist-at-minicard'}}")
-      if showAtMinicard
-        input.toggle-switch(type="checkbox" id="toggleShowChecklistAtMinicardButton" checked="checked")
-      else
-        input.toggle-switch(type="checkbox" id="toggleShowChecklistAtMinicardButton")
-      label.toggle-label(for="toggleShowChecklistAtMinicardButton")
-    hr
-    span.text-hide-checked-items
-      | {{_ 'hide-checked-items'}}
-    .material-toggle-switch(title="{{_ 'hide-checked-items'}}")
-      //span.toggle-switch-title
-      //.check-square-icon.i.fa.fa-check-square-o
-      if hideCheckedItems
-        input.toggle-switch(type="checkbox" id="toggleHideCheckedItemsButton" checked="checked")
-      else
-        input.toggle-switch(type="checkbox" id="toggleHideCheckedItemsButton")
-      label.toggle-label(for="toggleHideCheckedItemsButton")
-    hr
   ul.pop-over-list
     li
       a.js-delete-checklist.delete-checklist

+ 3 - 22
client/components/cards/checklists.js

@@ -202,6 +202,9 @@ BlazeComponent.extendComponent({
 
   events() {
     const events = {
+      'click #toggleHideCheckedItemsButton'() {
+        Meteor.call('toggleHideCheckedItems');
+      },
     };
 
     return [
@@ -271,11 +274,6 @@ Template.checklists.helpers({
     const ret = card.checklists();
     return ret;
   },
-  showAtMinicard() {
-    const card = ReactiveCache.getCard(this.cardId);
-    const ret = card.checklists({'showAtMinicard':1});
-    return ret;
-  },
   hideCheckedItems() {
     const currentUser = ReactiveCache.getCurrentUser();
     if (currentUser) return currentUser.hasHideCheckedItems();
@@ -303,26 +301,9 @@ BlazeComponent.extendComponent({
 }).register('addChecklistItemForm');
 
 BlazeComponent.extendComponent({
-  toggleItem() {
-    const checklist = this.currentData().checklist;
-    const item = this.currentData().item;
-    if (checklist && item && item._id) {
-      item.toggleItem();
-    }
-  },
   events() {
     return [
       {
-        'click .js-checklist-item .check-box-container': this.toggleItem,
-        'click #toggleShowChecklistAtMinicardButton'() {
-          const checklist = this.checklist;
-          if (checklist && checklist._id) {
-            Meteor.call('toggleShowChecklistAtMinicard', checklist._id);
-          }
-        },
-        'click #toggleHideCheckedItemsButton'() {
-          Meteor.call('toggleHideCheckedItems');
-        },
         'click .js-delete-checklist': Popup.afterConfirm('checklistDelete', function () {
           Popup.back(2);
           const checklist = this.checklist;

+ 0 - 17
client/components/cards/minicard.css

@@ -1,12 +1,3 @@
-.minicard .checklists-title,
-.minicard .add-checklist,
-.minicard .add-checklist-item,
-.minicard .checklist-details-menu {
-  display: none;
-}
-.minicard .checklist-progress-bar-container {
-  width: 190px; /* TODO: Add adjustable width https://github.com/wekan/wekan/pull/4964 */
-}
 .minicard-wrapper {
   cursor: pointer;
   position: relative;
@@ -138,14 +129,6 @@
   max-width: 100%;
   margin-right: 4px;
 }
-/*
-.minicard .checklists-title,
-.minicard .add-checklist,
-.minicard .add-checklist-item,
-.minicard .checklist-details-menu {
-  display: none;
-}
-*/
 .minicard .handle {
   width: 20px;
   height: 20px;

+ 0 - 6
client/components/cards/minicard.jade

@@ -112,12 +112,6 @@ template(name="minicard")
                     +viewer
                       = trueValue
 
-    .card-checklist-attachmentGalleries
-      .card-checklist-attachmentGallery.card-checklists
-        if currentBoard.allowsChecklists
-          //hr
-          //+checklists(cardId=_id showAtMinicard=true)
-
     if showAssignee
       if getAssignees
         .minicard-assignees.js-minicard-assignees

+ 0 - 5
client/components/cards/minicard.js

@@ -88,11 +88,6 @@ BlazeComponent.extendComponent({
   events() {
     return [
       {
-        'click .minicard-checklists'() {
-          // Prevents clicking checklist at minicard from opening card details,
-          // while still allowing checking checlist items.
-          event.preventDefault();
-        },
         'click .js-linked-link'() {
           if (this.data().isLinkedCard()) Utils.goCardId(this.data().linkedId);
           else if (this.data().isLinkedBoard())

+ 0 - 2
imports/i18n/data/en.i18n.json

@@ -1244,8 +1244,6 @@
   "translation": "Translation",
   "text": "Text",
   "translation-text": "Translation text",
-  "show-at-minicard": "Show at minicard",
-  "show-checklist-at-minicard": "Show checklist at minicard",
   "show-subtasks-field": "Show subtasks field",
   "convert-to-markdown": "Convert to markdown",
   "import-board-zip": "Add .zip file that has board JSON files, and board name subdirectories with attachments",

+ 0 - 20
models/checklists.js

@@ -27,14 +27,6 @@ Checklists.attachSchema(
       type: Date,
       optional: true,
     },
-    showAtMinicard: {
-      /**
-       * Show at minicard. Default: false.
-       */
-      type: Boolean,
-      optional: true,
-      defaultValue: false,
-    },
     createdAt: {
       /**
        * Creation date of the checklist
@@ -142,9 +134,6 @@ Checklists.helpers({
     const items = ReactiveCache.getChecklist({ _id: this._id }).items;
     return _.pluck(items, '_id').indexOf(itemId);
   },
-  hasShowChecklistAtMinicard() {
-    return showAtMinicard || false;
-  },
 });
 
 Checklists.allow({
@@ -202,15 +191,6 @@ Checklists.mutations({
       },
     };
   },
-
-  toggleShowChecklistAtMinicard(checklistId) {
-    const value = this.hasShowChecklistAtMinicard();
-    return {
-      $set: {
-        'showAtMinicard': !value,
-      },
-    };
-  },
 });
 
 if (Meteor.isServer) {