2
0
Эх сурвалжийг харах

[Fix Adding Labels to cards is not possible anymore](https://github.com/wekan/wekan/issues/2223).

Thanks to xet7 !

Closes #2223
Lauri Ojansivu 6 жил өмнө
parent
commit
763cf81c97

+ 30 - 0
client/components/boards/boardHeader.jade

@@ -133,6 +133,36 @@ template(name="boardVisibilityList")
             i.fa.fa-check
           span.sub-name {{_ 'public-desc'}}
 
+template(name="boardChangeVisibilityPopup")
+  +boardVisibilityList
+
+template(name="boardChangeWatchPopup")
+  ul.pop-over-list
+    li
+      with "watching"
+        a.js-select-watch
+          i.fa.fa-eye.colorful
+          | {{_ 'watching'}}
+          if watchCheck
+            i.fa.fa-check
+          span.sub-name {{_ 'watching-info'}}
+    li
+      with "tracking"
+        a.js-select-watch
+          i.fa.fa-bell.colorful
+          | {{_ 'tracking'}}
+          if watchCheck
+            i.fa.fa-check
+          span.sub-name {{_ 'tracking-info'}}
+    li
+      with "muted"
+        a.js-select-watch
+          i.fa.fa-bell-slash.colorful
+          | {{_ 'muted'}}
+          if watchCheck
+            i.fa.fa-check
+          span.sub-name {{_ 'muted-info'}}
+
 template(name="createBoard")
   form
     label

+ 53 - 0
client/components/boards/boardHeader.js

@@ -1,3 +1,49 @@
+Template.boardMenuPopup.events({
+  'click .js-rename-board': Popup.open('boardChangeTitle'),
+  'click .js-custom-fields'() {
+    Sidebar.setView('customFields');
+    Popup.close();
+  },
+  'click .js-open-archives'() {
+    Sidebar.setView('archives');
+    Popup.close();
+  },
+  'click .js-change-board-color': Popup.open('boardChangeColor'),
+  'click .js-change-language': Popup.open('changeLanguage'),
+  'click .js-archive-board ': Popup.afterConfirm('archiveBoard', function() {
+    const currentBoard = Boards.findOne(Session.get('currentBoard'));
+    currentBoard.archive();
+    // XXX We should have some kind of notification on top of the page to
+    // confirm that the board was successfully archived.
+    FlowRouter.go('home');
+  }),
+  'click .js-delete-board': Popup.afterConfirm('deleteBoard', function() {
+    const currentBoard = Boards.findOne(Session.get('currentBoard'));
+    Popup.close();
+    Boards.remove(currentBoard._id);
+    FlowRouter.go('home');
+  }),
+  'click .js-outgoing-webhooks': Popup.open('outgoingWebhooks'),
+  'click .js-import-board': Popup.open('chooseBoardSource'),
+  'click .js-subtask-settings': Popup.open('boardSubtaskSettings'),
+});
+
+Template.boardMenuPopup.helpers({
+  exportUrl() {
+    const params = {
+      boardId: Session.get('currentBoard'),
+    };
+    const queryParams = {
+      authToken: Accounts._storedLoginToken(),
+    };
+    return FlowRouter.path('/api/boards/:boardId/export', params, queryParams);
+  },
+  exportFilename() {
+    const boardId = Session.get('currentBoard');
+    return `wekan-export-board-${boardId}.json`;
+  },
+});
+
 Template.boardChangeTitlePopup.events({
   submit(evt, tpl) {
     const newTitle = tpl.$('.js-board-name').val().trim();
@@ -35,8 +81,12 @@ BlazeComponent.extendComponent({
       'click .js-star-board'() {
         Meteor.user().toggleBoardStar(Session.get('currentBoard'));
       },
+      'click .js-open-board-menu': Popup.open('boardMenu'),
       'click .js-change-visibility': Popup.open('boardChangeVisibility'),
       'click .js-watch-board': Popup.open('boardChangeWatch'),
+      'click .js-open-archived-board'() {
+        Modal.open('archivedBoards');
+      },
       'click .js-toggle-board-view'() {
         const currentUser = Meteor.user();
         if (currentUser.profile.boardView === 'board-view-swimlanes') {
@@ -136,6 +186,9 @@ const CreateBoard = BlazeComponent.extendComponent({
         this.setVisibility(this.currentData());
       },
       'click .js-change-visibility': this.toggleVisibilityMenu,
+      'click .js-import': Popup.open('boardImportBoard'),
+      submit: this.onSubmit,
+      'click .js-import-board': Popup.open('chooseBoardSource'),
       'click .js-board-template': Popup.open('searchElement'),
     }];
   },

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

@@ -56,36 +56,6 @@ template(name="membersWidget")
     button.js-member-invite-accept.primary {{_ 'accept'}}
     button.js-member-invite-decline {{_ 'decline'}}
 
-template(name="boardChangeVisibilityPopup")
-  +boardVisibilityList
-
-template(name="boardChangeWatchPopup")
-  ul.pop-over-list
-    li
-      with "watching"
-        a.js-select-watch
-          i.fa.fa-eye.colorful
-          | {{_ 'watching'}}
-          if watchCheck
-            i.fa.fa-check
-          span.sub-name {{_ 'watching-info'}}
-    li
-      with "tracking"
-        a.js-select-watch
-          i.fa.fa-bell.colorful
-          | {{_ 'tracking'}}
-          if watchCheck
-            i.fa.fa-check
-          span.sub-name {{_ 'tracking-info'}}
-    li
-      with "muted"
-        a.js-select-watch
-          i.fa.fa-bell-slash.colorful
-          | {{_ 'muted'}}
-          if watchCheck
-            i.fa.fa-check
-          span.sub-name {{_ 'muted-info'}}
-
 template(name="boardChangeColorPopup")
   .board-backgrounds-list.clearfix
     each backgroundColors

+ 13 - 11
models/activities.js

@@ -56,23 +56,22 @@ Activities.helpers({
   customField() {
     return CustomFields.findOne(this.customFieldId);
   },
-  label() {
-    return Labels.findOne(this.labelId);
-  },
+  // Label activity did not work yet, unable to edit labels when tried this.
+  //label() {
+  //  return Cards.findOne(this.labelId);
+  //},
 });
 
 Activities.before.insert((userId, doc) => {
   doc.createdAt = new Date();
 });
 
-
 Activities.after.insert((userId, doc) => {
   const activity = Activities._transform(doc);
   RulesHelper.executeRules(activity);
 
 });
 
-
 if (Meteor.isServer) {
   // For efficiency create indexes on the date of creation, and on the date of
   // creation in conjunction with the card or board id, as corresponding views
@@ -84,7 +83,9 @@ if (Meteor.isServer) {
     Activities._collection._ensureIndex({ commentId: 1 }, { partialFilterExpression: { commentId: { $exists: true } } });
     Activities._collection._ensureIndex({ attachmentId: 1 }, { partialFilterExpression: { attachmentId: { $exists: true } } });
     Activities._collection._ensureIndex({ customFieldId: 1 }, { partialFilterExpression: { customFieldId: { $exists: true } } });
-    Activities._collection._ensureIndex({ labelId: 1 }, { partialFilterExpression: { labelId: { $exists: true } } });
+    // Label activity did not work yet, unable to edit labels when tried this.
+    //Activities._collection._dropIndex({ labelId: 1 }, { "indexKey": -1 });
+    //Activities._collection._dropIndex({ labelId: 1 }, { partialFilterExpression: { labelId: { $exists: true } } });
   });
 
   Activities.after.insert((userId, doc) => {
@@ -173,11 +174,12 @@ if (Meteor.isServer) {
       const customField = activity.customField();
       params.customField = customField.name;
     }
-    if (activity.labelId) {
-      const label = activity.label();
-      params.label = label.name;
-      params.labelId = activity.labelId;
-    }
+    // Label activity did not work yet, unable to edit labels when tried this.
+    //if (activity.labelId) {
+    //  const label = activity.label();
+    //  params.label = label.name;
+    //  params.labelId = activity.labelId;
+    //}
     if (board) {
       const watchingUsers = _.pluck(_.where(board.watchers, {level: 'watching'}), 'userId');
       const trackingUsers = _.pluck(_.where(board.watchers, {level: 'tracking'}), 'userId');

+ 2 - 1
server/notifications/outgoing.js

@@ -16,8 +16,9 @@ Meteor.methods({
     check(description, String);
     check(params, Object);
 
+    // label activity did not work yet, see wekan/models/activities.js
     const quoteParams = _.clone(params);
-    ['card', 'list', 'oldList', 'board', 'oldBoard', 'comment', 'checklist', 'label', 'swimlane', 'oldSwimlane'].forEach((key) => {
+    ['card', 'list', 'oldList', 'board', 'oldBoard', 'comment', 'checklist', 'swimlane', 'oldSwimlane'].forEach((key) => {
       if (quoteParams[key]) quoteParams[key] = `"${params[key]}"`;
     });