Browse Source

Fixed per-card and per-board settings of showing checkist at minicard.

Thanks to xet7 !
Lauri Ojansivu 4 days ago
parent
commit
fc32a89292

+ 8 - 0
client/components/cards/cardDetails.jade

@@ -695,6 +695,14 @@ template(name="cardDetailsActionsPopup")
           a.js-set-card-color
             i.fa.fa-paint-brush
             | {{_ 'setCardColorPopup-title'}}
+        li
+          a.js-toggle-show-list-on-minicard
+            if showListOnMinicard
+              i.fa.fa-eye
+              | {{_ 'hide-list-on-minicard'}}
+            else
+              i.fa.fa-eye-slash
+              | {{_ 'show-list-on-minicard'}}
   hr
   ul.pop-over-list
     li

+ 10 - 0
client/components/cards/cardDetails.js

@@ -657,6 +657,10 @@ Template.cardDetailsActionsPopup.helpers({
   isBoardAdmin() {
     return ReactiveCache.getCurrentUser().isBoardAdmin();
   },
+
+  showListOnMinicard() {
+    return this.showListOnMinicard;
+  },
 });
 
 Template.cardDetailsActionsPopup.events({
@@ -702,6 +706,12 @@ Template.cardDetailsActionsPopup.events({
       if (!err && ret) Popup.close();
     });
   },
+  'click .js-toggle-show-list-on-minicard'() {
+    const currentCard = this;
+    const newValue = !currentCard.showListOnMinicard;
+    Cards.update(currentCard._id, { $set: { showListOnMinicard: newValue } });
+    Popup.close();
+  },
 });
 
 BlazeComponent.extendComponent({

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

@@ -588,3 +588,18 @@
   transform: scale(1.02);
   transition: all 0.2s ease;
 }
+
+/* List name display on minicard */
+.minicard-list-name {
+  font-size: 0.75em;
+  color: #8c8c8c;
+  margin-top: 0.2vh;
+  display: flex;
+  align-items: center;
+  gap: 0.3vw;
+}
+
+.minicard-list-name i.fa {
+  font-size: 0.8em;
+  opacity: 0.7;
+}

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

@@ -72,6 +72,10 @@ template(name="minicard")
           span.card-number
             | ##{getCardNumber}
         = getTitle
+if shouldShowListOnMinicard
+  .minicard-list-name
+    i.fa.fa-list
+    | {{ listName }}
       if $eq 'subtext-with-full-path' currentBoard.presentParentTask
         .parent-subtext
           | {{ parentString ' > ' }}

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

@@ -196,6 +196,17 @@ Template.minicard.helpers({
   },
   uploadCount() {
     return uploadProgressManager.getUploadCountForCard(this._id);
+  },
+  listName() {
+    const list = this.list();
+    return list ? list.title : '';
+  },
+
+  shouldShowListOnMinicard() {
+    // Show list name if either:
+    // 1. Board-wide setting is enabled, OR
+    // 2. This specific card has the setting enabled
+    return this.currentBoard.allowsShowListsOnMinicard || this.showListOnMinicard;
   }
 });
 

+ 6 - 0
client/components/sidebar/sidebar.jade

@@ -284,6 +284,12 @@ template(name="boardCardSettingsPopup")
         span
           i.fa.fa-tags
           | {{_ 'labels'}}
+    div.check-div
+      a.flex.js-field-has-card-show-lists-on-minicard(class="{{#if allowsShowListsOnMinicard}}is-checked{{/if}}")
+        .materialCheckBox(class="{{#if allowsShowListsOnMinicard}}is-checked{{/if}}")
+        span
+          i.fa.fa-list
+          | {{_ 'card-show-lists-on-minicard'}}
     div.check-div
       a.flex.js-field-has-card-number(class="{{#if allowsCardNumber}}is-checked{{/if}}")
         .materialCheckBox(class="{{#if allowsCardNumber}}is-checked{{/if}}")

+ 22 - 1
client/components/sidebar/sidebar.js

@@ -996,10 +996,15 @@ BlazeComponent.extendComponent({
     return this.currentBoard.allowsShowLists;
   },
 
+
   allowsLabels() {
     return this.currentBoard.allowsLabels;
   },
 
+  allowsShowListsOnMinicard() {
+    return this.currentBoard.allowsShowListsOnMinicard;
+  },
+
   allowsChecklists() {
     return this.currentBoard.allowsChecklists;
   },
@@ -1282,13 +1287,29 @@ BlazeComponent.extendComponent({
           this.currentBoard.setAllowsLabels(this.currentBoard.allowsLabels);
           $(`.js-field-has-labels ${MCB}`).toggleClass(
             CKCLS,
-            this.currentBoard.allowsAssignee,
+            this.currentBoard.allowsLabels,
           );
           $('.js-field-has-labels').toggleClass(
             CKCLS,
             this.currentBoard.allowsLabels,
           );
         },
+        'click .js-field-has-card-show-lists-on-minicard'(evt) {
+          evt.preventDefault();
+          this.currentBoard.allowsShowListsOnMinicard = !this.currentBoard
+            .allowsShowListsOnMinicard;
+          this.currentBoard.setAllowsShowListsOnMinicard(
+            this.currentBoard.allowsShowListsOnMinicard,
+          );
+          $(`.js-field-has-card-show-lists-on-minicard ${MCB}`).toggleClass(
+            CKCLS,
+            this.currentBoard.allowsShowListsOnMinicard,
+          );
+          $('.js-field-has-card-show-lists-on-minicard').toggleClass(
+            CKCLS,
+            this.currentBoard.allowsShowListsOnMinicard,
+          );
+        },
         'click .js-field-has-description-title'(evt) {
           evt.preventDefault();
           this.currentBoard.allowsDescriptionTitle = !this.currentBoard

+ 4 - 1
imports/i18n/en.i18n.json

@@ -83,5 +83,8 @@
   "monitoring-export-failed": "Failed to export monitoring data",
   "filesystem-storage": "Filesystem",
   "gridfs-storage": "GridFS",
-  "s3-storage": "S3"
+  "s3-storage": "S3",
+  "card-show-lists-on-minicard": "Show Lists on Minicard",
+  "show-list-on-minicard": "Show List on Minicard",
+  "hide-list-on-minicard": "Hide List on Minicard"
 }

+ 13 - 0
models/boards.js

@@ -512,6 +512,7 @@ Boards.attachSchema(
       defaultValue: true,
     },
 
+
     allowsAssignedBy: {
       /**
        * Does the board allows requested by?
@@ -519,6 +520,13 @@ Boards.attachSchema(
       type: Boolean,
       defaultValue: true,
     },
+    allowsShowListsOnMinicard: {
+      /**
+       * Does the board allow showing list names on all minicards?
+       */
+      type: Boolean,
+      defaultValue: false,
+    },
 
     allowsReceivedDate: {
       /**
@@ -1464,6 +1472,10 @@ Boards.mutations({
     return { $set: { allowsAssignedBy } };
   },
 
+  setAllowsShowListsOnMinicard(allowsShowListsOnMinicard) {
+    return { $set: { allowsShowListsOnMinicard } };
+  },
+
   setAllowsRequestedBy(allowsRequestedBy) {
     return { $set: { allowsRequestedBy } };
   },
@@ -1476,6 +1488,7 @@ Boards.mutations({
     return { $set: { allowsShowLists } };
   },
 
+
   setAllowsAttachments(allowsAttachments) {
     return { $set: { allowsAttachments } };
   },

+ 8 - 0
models/cards.js

@@ -484,6 +484,14 @@ Cards.attachSchema(
       type: Boolean,
       optional: true,
     },
+    showListOnMinicard: {
+      /**
+       * show list name on minicard?
+       */
+      type: Boolean,
+      optional: true,
+      defaultValue: false,
+    },
   }),
 );
 

+ 1 - 0
server/migrations.js

@@ -1141,6 +1141,7 @@ Migrations.add('add-description-text-allowed-on-minicard', () => {
   );
 });
 
+
 Migrations.add('add-sort-field-to-boards', () => {
   Boards.find().forEach((board, index) => {
     if (!board.hasOwnProperty('sort')) {