ソースを参照

Added option to show/hide some badges on minicard

helioguardabaxo 2 年 前
コミット
f3ebc4a28e

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

@@ -132,9 +132,10 @@ template(name="minicard")
           if expiredPoker
             span.badge-text {{ getPokerEstimation }}
       if attachments.length
-        .badge
-          span.badge-icon.fa.fa-paperclip
-          span.badge-text= attachments.length
+        if currentBoard.allowsBadgeAttachmentOnMinicard
+          .badge
+            span.badge-icon.fa.fa-paperclip
+            span.badge-text= attachments.length
       if checklists.count
         .badge(class="{{#if checklistFinished}}is-finished{{/if}}")
           span.badge-icon.fa.fa-check-square-o
@@ -145,9 +146,10 @@ template(name="minicard")
           span.badge-text.check-list-text {{subtasksFinishedCount}}/{{allSubtasksCount}}
           //{{subtasksFinishedCount}}/{{subtasksCount}} does not work because when a subtaks is archived, the count goes down
       if currentBoard.allowsCardSortingByNumber
-        .badge
-          span.badge-icon.fa.fa-sort
-          span.badge-text.check-list-sort {{ sort }}
+        if currentBoard.allowsCardSortingByNumberOnMinicard
+          .badge
+            span.badge-icon.fa.fa-sort
+            span.badge-text.check-list-sort {{ sort }}
     if currentBoard.allowsDescriptionTextOnMinicard
       if getDescription
         .minicard-description

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

@@ -308,6 +308,18 @@ template(name="boardMinicardSettingsPopup")
         span
           i.fa.fa-paperclip
           | {{_ 'cover-attachment-on-minicard'}}
+    div.check-div
+      a.flex.js-field-has-badge-attachment-on-minicard(class="{{#if allowsBadgeAttachmentOnMinicard}}is-checked{{/if}}")
+        .materialCheckBox(class="{{#if allowsBadgeAttachmentOnMinicard}}is-checked{{/if}}")
+        span
+          i.fa.fa-paperclip
+          | {{_ 'badge-attachment-on-minicard'}}
+    div.check-div
+      a.flex.js-field-has-card-sorting-by-number-on-minicard(class="{{#if allowsCardSortingByNumberOnMinicard}}is-checked{{/if}}")
+        .materialCheckBox(class="{{#if allowsCardSortingByNumberOnMinicard}}is-checked{{/if}}")
+        span
+          i.fa.fa-sort
+          | {{_ 'card-sorting-by-number-on-minicard'}}
 
 template(name="boardSubtaskSettingsPopup")
   form.board-subtask-settings

+ 40 - 0
client/components/sidebar/sidebar.js

@@ -1330,6 +1330,14 @@ BlazeComponent.extendComponent({
     return this.currentBoard.allowsCoverAttachmentOnMinicard;
   },
 
+  allowsBadgeAttachmentOnMinicard() {
+    return this.currentBoard.allowsBadgeAttachmentOnMinicard;
+  },
+
+  allowsCardSortingByNumberOnMinicard() {
+    return this.currentBoard.allowsCardSortingByNumberOnMinicard;
+  },
+
  lists() {
     return Lists.find(
       {
@@ -1387,6 +1395,38 @@ BlazeComponent.extendComponent({
             this.currentBoard.allowsCoverAttachmentOnMinicard,
           );
         },
+        'click .js-field-has-badge-attachment-on-minicard'(evt) {
+          evt.preventDefault();
+          this.currentBoard.allowsBadgeAttachmentOnMinicard = !this.currentBoard
+            .allowsBadgeAttachmentOnMinicard;
+          this.currentBoard.setallowsBadgeAttachmentOnMinicard(
+            this.currentBoard.allowsBadgeAttachmentOnMinicard,
+          );
+          $(`.js-field-has-badge-attachment-on-minicard ${MCB}`).toggleClass(
+            CKCLS,
+            this.currentBoard.allowsBadgeAttachmentOnMinicard,
+          );
+          $('.js-field-has-badge-attachment-on-minicard').toggleClass(
+            CKCLS,
+            this.currentBoard.allowsBadgeAttachmentOnMinicard,
+          );
+        },
+        'click .js-field-has-card-sorting-by-number-on-minicard'(evt) {
+          evt.preventDefault();
+          this.currentBoard.allowsCardSortingByNumberOnMinicard = !this.currentBoard
+            .allowsCardSortingByNumberOnMinicard;
+          this.currentBoard.setallowsCardSortingByNumberOnMinicard(
+            this.currentBoard.allowsCardSortingByNumberOnMinicard,
+          );
+          $(`.js-field-has-card-sorting-by-number-on-minicard ${MCB}`).toggleClass(
+            CKCLS,
+            this.currentBoard.allowsCardSortingByNumberOnMinicard,
+          );
+          $('.js-field-has-card-sorting-by-number-on-minicard').toggleClass(
+            CKCLS,
+            this.currentBoard.allowsCardSortingByNumberOnMinicard,
+          );
+        },
       },
     ];
   },

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

@@ -729,6 +729,8 @@
   "show-parent-in-minicard": "Show parent in minicard:",
   "description-on-minicard": "Description on minicard",
   "cover-attachment-on-minicard": "Cover attachment on minicard",
+  "badge-attachment-on-minicard": "Badge attachment on minicard",
+  "card-sorting-by-number-on-minicard": "Card sorting by number on minicard",
   "prefix-with-full-path": "Prefix with full path",
   "prefix-with-parent": "Prefix with parent",
   "subtext-with-full-path": "Subtext with full path",

+ 24 - 0
models/boards.js

@@ -415,6 +415,22 @@ Boards.attachSchema(
       defaultValue: false,
     },
 
+    allowsBadgeAttachmentOnMinicard: {
+      /**
+       * Does the board allows badge attachment on minicard?
+       */
+      type: Boolean,
+      defaultValue: false,
+    },
+
+    allowsCardSortingByNumberOnMinicard: {
+      /**
+       * Does the board allows card sorting by number on minicard?
+       */
+      type: Boolean,
+      defaultValue: false,
+    },
+
     allowsCardNumber: {
       /**
        * Does the board allows card numbers?
@@ -1471,6 +1487,14 @@ Boards.mutations({
     return { $set: { allowsCoverAttachmentOnMinicard } };
   },
 
+  setallowsBadgeAttachmentOnMinicard(allowsBadgeAttachmentOnMinicard) {
+    return { $set: { allowsBadgeAttachmentOnMinicard } };
+  },
+
+  setallowsCardSortingByNumberOnMinicard(allowsCardSortingByNumberOnMinicard) {
+    return { $set: { allowsCardSortingByNumberOnMinicard } };
+  },
+
   setAllowsActivities(allowsActivities) {
     return { $set: { allowsActivities } };
   },

+ 8 - 0
public/api/wekan.yml

@@ -3010,6 +3010,14 @@ definitions:
         description: |
            Does the board allows cover attachment on minicard?
         type: boolean
+      allowsBadgeAttachmentOnMinicard:
+        description: |
+           Does the board allows badge attachment on minicard?
+        type: boolean
+      allowsCardSortingByNumberOnMinicard:
+        description: |
+           Does the board allows card sorting by number on minicard?
+        type: boolean
       allowsCardNumber:
         description: |
            Does the board allows card numbers?