Ver código fonte

added the confirm pop up before cloning or archiving a board

Zegden Rayen 3 meses atrás
pai
commit
094f13934c
1 arquivos alterados com 31 adições e 24 exclusões
  1. 31 24
      client/components/boards/boardsList.js

+ 31 - 24
client/components/boards/boardsList.js

@@ -239,34 +239,41 @@ BlazeComponent.extendComponent({
           evt.preventDefault();
           evt.preventDefault();
         },
         },
         'click .js-clone-board'(evt) {
         'click .js-clone-board'(evt) {
-          let title = getSlug(ReactiveCache.getBoard(this.currentData()._id).title) || 'cloned-board';
-          Meteor.call(
-            'copyBoard',
-            this.currentData()._id,
-            {
-              sort: ReactiveCache.getBoards({ archived: false }).length,
-              type: 'board',
-              title: ReactiveCache.getBoard(this.currentData()._id).title,
-            },
-            (err, res) => {
-              if (err) {
-                console.error(err);
-              } else {
-                Session.set('fromBoard', null);
-                subManager.subscribe('board', res, false);
-                FlowRouter.go('board', {
-                  id: res,
-                  slug: title,
-                });
-              }
-            },
-          );
-          evt.preventDefault();
+          if (confirm('Are you sure you want to clone this board?')) {
+            let title =
+              getSlug(ReactiveCache.getBoard(this.currentData()._id).title) ||
+              'cloned-board';
+            Meteor.call(
+              'copyBoard',
+              this.currentData()._id,
+              {
+                sort: ReactiveCache.getBoards({ archived: false }).length,
+                type: 'board',
+                title: ReactiveCache.getBoard(this.currentData()._id).title,
+              },
+              (err, res) => {
+                if (err) {
+                  console.error(err);
+                } else {
+                  Session.set('fromBoard', null);
+                  subManager.subscribe('board', res, false);
+                  FlowRouter.go('board', {
+                    id: res,
+                    slug: title,
+                  });
+                }
+              },
+            );
+            evt.preventDefault();
+          }
         },
         },
         'click .js-archive-board'(evt) {
         'click .js-archive-board'(evt) {
-          const boardId = this.currentData()._id;
+          if (confirm('Are you sure you want to archive this board?'))
+          {
+            const boardId = this.currentData()._id;
           Meteor.call('archiveBoard', boardId);
           Meteor.call('archiveBoard', boardId);
           evt.preventDefault();
           evt.preventDefault();
+          }
         },
         },
         'click .js-accept-invite'() {
         'click .js-accept-invite'() {
           const boardId = this.currentData()._id;
           const boardId = this.currentData()._id;