Преглед на файлове

Added hide/show to show counters and members on All Boards (Admin Panel)

helioguardabaxo преди 2 години
родител
ревизия
9dff09fbcf

+ 12 - 10
client/components/boards/boardsList.jade

@@ -94,16 +94,18 @@ template(name="boardList")
                   span.board-list-item-name(title="{{_ 'board-drag-drop-reorder-or-click-open'}}")
                     +viewer
                       = title
-                  if allowsBoardMemberList
-                    .minicard-members
-                      each member in boardMembers _id
-                        a.name
-                          +userAvatar(userId=member noRemove=true)
-                  if allowsCardCounterList
-                    .minicard-lists.flex.flex-wrap
-                      each list in boardLists _id
-                        .item
-                          | {{ list }}
+                  unless currentSetting.hideBoardMemberList
+                    if allowsBoardMemberList
+                      .minicard-members
+                        each member in boardMembers _id
+                          a.name
+                            +userAvatar(userId=member noRemove=true)
+                  unless currentSetting.hideCardCounterList
+                    if allowsCardCounterList
+                      .minicard-lists.flex.flex-wrap
+                        each list in boardLists _id
+                          .item
+                            | {{ list }}
                   i.fa.js-star-board(
                     class="fa-star{{#if isStarred}} is-star-active{{else}}-o{{/if}}"
                     title="{{_ 'star-board-title'}}")

+ 12 - 0
client/components/boards/boardsList.js

@@ -2,6 +2,18 @@ import { TAPi18n } from '/imports/i18n';
 
 const subManager = new SubsManager();
 
+Template.boardList.helpers({
+  currentSetting() {
+    return Settings.findOne();
+  },
+  hideCardCounterList() {
+    return Utils.isMiniScreen() && Session.get('currentBoard');
+  },
+  hideBoardMemberList() {
+    return Utils.isMiniScreen() && Session.get('currentBoard');
+  },
+})
+
 Template.boardListHeaderBar.events({
   'click .js-open-archived-board'() {
     Modal.open('archivedBoards');

+ 14 - 0
client/components/settings/settingBody.jade

@@ -253,6 +253,20 @@ template(name='layoutSettings')
       .title {{_ 'automatic-linked-url-schemes'}}
       .form-group
         textarea#automatic-linked-url-schemes.wekan-form-control= currentSetting.automaticLinkedUrlSchemes
+    li.layout-form
+      .title {{_ 'hide-card-counter-list'}}
+      .form-group.flex
+        input.wekan-form-control#hide-card-counter-list(type="radio" name="hideCardCounterList" value="true" checked="{{#if currentSetting.hideCardCounterList}}checked{{/if}}")
+        span {{_ 'yes'}}
+        input.wekan-form-control#hide-card-counter-list(type="radio" name="hideCardCounterList" value="false" checked="{{#unless currentSetting.hideCardCounterList}}checked{{/unless}}")
+        span {{_ 'no'}}
+    li.layout-form
+      .title {{_ 'hide-board-member-list'}}
+      .form-group.flex
+        input.wekan-form-control#hide-board-member-list(type="radio" name="hideBoardMemberList" value="true" checked="{{#if currentSetting.hideBoardMemberList}}checked{{/if}}")
+        span {{_ 'yes'}}
+        input.wekan-form-control#hide-board-member-list(type="radio" name="hideBoardMemberList" value="false" checked="{{#unless currentSetting.hideBoardMemberList}}checked{{/unless}}")
+        span {{_ 'no'}}
     li
       button.js-save-layout.primary {{_ 'save'}}
 

+ 12 - 0
client/components/settings/settingBody.js

@@ -85,6 +85,12 @@ BlazeComponent.extendComponent({
   toggleHideLogo() {
     $('#hide-logo').toggleClass('is-checked');
   },
+  toggleHideCardCounterList() {
+    $('#hide-card-counter-list').toggleClass('is-checked');
+  },
+  toggleHideBoardMemberList() {
+    $('#hide-board-member-list').toggleClass('is-checked');
+  },
   toggleDisplayAuthenticationMethod() {
     $('#display-authentication-method').toggleClass('is-checked');
   },
@@ -230,6 +236,8 @@ BlazeComponent.extendComponent({
       .val()
       .trim();
     const hideLogoChange = $('input[name=hideLogo]:checked').val() === 'true';
+    const hideCardCounterListChange = $('input[name=hideCardCounterList]:checked').val() === 'true';
+    const hideBoardMemberListChange = $('input[name=hideBoardMemberList]:checked').val() === 'true';
     const displayAuthenticationMethod =
       $('input[name=displayAuthenticationMethod]:checked').val() === 'true';
     const defaultAuthenticationMethod = $('#defaultAuthenticationMethod').val();
@@ -241,6 +249,8 @@ BlazeComponent.extendComponent({
         $set: {
           productName,
           hideLogo: hideLogoChange,
+          hideCardCounterList: hideCardCounterListChange,
+          hideBoardMemberList: hideBoardMemberListChange,
           customLoginLogoImageUrl,
           customLoginLogoLinkUrl,
           customHelpLinkUrl,
@@ -291,6 +301,8 @@ BlazeComponent.extendComponent({
         'click button.js-save': this.saveMailServerInfo,
         'click button.js-send-smtp-test-email': this.sendSMTPTestEmail,
         'click a.js-toggle-hide-logo': this.toggleHideLogo,
+        'click a.js-toggle-hide-card-counter-list': this.toggleHideCardCounterList,
+        'click a.js-toggle-hide-board-member-list': this.toggleHideBoardMemberList,
         'click button.js-save-layout': this.saveLayout,
         'click a.js-toggle-display-authentication-method': this
           .toggleDisplayAuthenticationMethod,

+ 20 - 16
client/components/sidebar/sidebar.jade

@@ -140,18 +140,20 @@ template(name="boardChangeColorPopup")
 template(name="boardInfoOnMyBoardsPopup")
   form.board-info-on-my-boards
     h3 {{_ 'show-at-all-boards-page'}}
-    div.check-div
-      a.flex.js-field-has-cardcounterlist(class="{{#if allowsCardCounterList}}is-checked{{/if}}")
-        .materialCheckBox(class="{{#if allowsCardCounterList}}is-checked{{/if}}")
-        span
-          i.fa.fa-sign-out
-          | {{_ 'show-card-counter-per-list'}}
-    div.check-div
-      a.flex.js-field-has-boardmemberlist(class="{{#if allowsBoardMemberList}}is-checked{{/if}}")
-        .materialCheckBox(class="{{#if allowsBoardMemberList}}is-checked{{/if}}")
-        span
-          i.fa.fa-hourglass-start
-          | {{_ 'show-board_members-avatar'}}
+    unless currentSetting.hideCardCounterList
+      div.check-div
+        a.flex.js-field-has-cardcounterlist(class="{{#if allowsCardCounterList}}is-checked{{/if}}")
+          .materialCheckBox(class="{{#if allowsCardCounterList}}is-checked{{/if}}")
+          span
+            i.fa.fa-sign-out
+            | {{_ 'show-card-counter-per-list'}}
+    unless currentSetting.hideBoardMemberList
+      div.check-div
+        a.flex.js-field-has-boardmemberlist(class="{{#if allowsBoardMemberList}}is-checked{{/if}}")
+          .materialCheckBox(class="{{#if allowsBoardMemberList}}is-checked{{/if}}")
+          span
+            i.fa.fa-hourglass-start
+            | {{_ 'show-board_members-avatar'}}
 
 template(name="boardCardSettingsPopup")
   form.board-card-settings
@@ -407,10 +409,12 @@ template(name="boardMenuPopup")
           i.fa.fa-paint-brush
           | {{_ 'board-change-color'}}
     if currentUser.isBoardAdmin
-      li
-        a.js-board-info-on-my-boards(title="{{_ 'board-info-on-my-boards'}}")
-          i.fa.fa-id-card-o
-          | {{_ 'board-info-on-my-boards'}}
+      unless currentSetting.hideBoardMemberList
+        unless currentSetting.hideCardCounterList
+          li
+            a.js-board-info-on-my-boards(title="{{_ 'board-info-on-my-boards'}}")
+              i.fa.fa-id-card-o
+              | {{_ 'board-info-on-my-boards'}}
   hr
   ul.pop-over-list
     if withApi

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

@@ -22,6 +22,8 @@ BlazeComponent.extendComponent({
   onCreated() {
     this._isOpen = new ReactiveVar(false);
     this._view = new ReactiveVar(defaultView);
+    this._hideCardCounterList = new ReactiveVar(false);
+    this._hideBoardMemberList = new ReactiveVar(false);
     Sidebar = this;
   },
 
@@ -143,6 +145,18 @@ Template.homeSidebar.helpers({
   },
 });
 
+Template.boardInfoOnMyBoardsPopup.helpers({
+  currentSetting() {
+    return Settings.findOne();
+  },
+  hideCardCounterList() {
+    return Utils.isMiniScreen() && Session.get('currentBoard');
+  },
+  hideBoardMemberList() {
+    return Utils.isMiniScreen() && Session.get('currentBoard');
+  },
+})
+
 EscapeActions.register(
   'sidebarView',
   () => {

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

@@ -854,7 +854,8 @@
   "custom-product-name": "Custom Product Name",
   "layout": "Layout",
   "hide-logo": "Hide Logo",
-  "hide-logo2": "Hide Logo2",
+  "hide-card-counter-list": "Hide card counter list on All Boards",
+  "hide-board-member-list": "Hide board member list on All Boards",
   "add-custom-html-after-body-start": "Add Custom HTML after <body> start",
   "add-custom-html-before-body-end": "Add Custom HTML before </body> end",
   "error-undefined": "Something went wrong",

+ 8 - 0
models/settings.js

@@ -64,6 +64,14 @@ Settings.attachSchema(
       type: Boolean,
       optional: true,
     },
+    hideCardCounterList: {
+      type: Boolean,
+      optional: true,
+    },
+    hideBoardMemberList: {
+      type: Boolean,
+      optional: true,
+    },
     customLoginLogoImageUrl: {
       type: String,
       optional: true,

+ 64 - 0
server/migrations.js

@@ -509,6 +509,38 @@ Migrations.add('add-hide-logo', () => {
   );
 });
 
+Migrations.add('add-hide-card-counter-list', () => {
+  Settings.update(
+    {
+      hideCardCounterList: {
+        $exists: false,
+      },
+    },
+    {
+      $set: {
+        hideCardCounterList: false,
+      },
+    },
+    noValidateMulti,
+  );
+});
+
+Migrations.add('add-hide-board-member-list', () => {
+  Settings.update(
+    {
+      hideBoardMemberList: {
+        $exists: false,
+      },
+    },
+    {
+      $set: {
+        hideBoardMemberList: false,
+      },
+    },
+    noValidateMulti,
+  );
+});
+
 Migrations.add('add-displayAuthenticationMethod', () => {
   Settings.update(
     {
@@ -1126,6 +1158,38 @@ Migrations.add('add-hide-logo-by-default', () => {
   );
 });
 
+Migrations.add('add-hide-card-counter-list-by-default', () => {
+  Settings.update(
+    {
+      hideCardCounterList: {
+        hideCardCounterList: false,
+      },
+    },
+    {
+      $set: {
+        hideCardCounterList: true,
+      },
+    },
+    noValidateMulti,
+  );
+});
+
+Migrations.add('add-hide-board-member-list-by-default', () => {
+  Settings.update(
+    {
+      hideBoardMemberList: {
+        hideBoardMember: false,
+      },
+    },
+    {
+      $set: {
+        hideBoardMemberList: true,
+      },
+    },
+    noValidateMulti,
+  );
+});
+
 Migrations.add('add-card-number-allowed', () => {
   Boards.update(
     {

+ 2 - 0
server/publications/settings.js

@@ -13,6 +13,8 @@ Meteor.publish('setting', () => {
         disableForgotPassword: 1,
         productName: 1,
         hideLogo: 1,
+        hideCardCounterList: 1,
+        hideBoardMemberList: 1,
         customLoginLogoImageUrl: 1,
         customLoginLogoLinkUrl: 1,
         customHelpLinkUrl: 1,