Ver código fonte

add popup to confirm deleting one account

guillaume 6 anos atrás
pai
commit
84ba42f42e

+ 2 - 2
client/components/settings/peopleBody.js

@@ -243,8 +243,8 @@ Template.editUserPopup.events({
     } else Popup.close();
   },
 
-  'click #deleteButton'() {
+  'click #deleteButton': Popup.afterConfirm('userDelete', function() {
     Users.remove(this.userId);
     Popup.close();
-  },
+  }),
 });

+ 5 - 0
client/components/users/userHeader.jade

@@ -82,3 +82,8 @@ template(name="changeSettingsPopup")
         | {{_ 'show-cards-minimum-count'}}
       input#show-cards-count-at.inline-input.left(type="number" value="#{showCardsCountAt}" min="0" max="99" onkeydown="return false")
       input.js-apply-show-cards-at.left(type="submit" value="{{_ 'apply'}}")
+
+
+template(name="userDeletePopup")
+  p {{_ 'delete-user-confirm-popup'}}
+  button.js-confirm.negate.full(type="submit") {{_ 'delete'}}

+ 3 - 3
client/components/users/userHeader.js

@@ -104,11 +104,11 @@ Template.editProfilePopup.events({
       });
     } else Popup.back();
   },
-  'click #deleteButton'() {
-    Users.remove(Meteor.userId());
+  'click #deleteButton': Popup.afterConfirm('userDelete', function() {
     Popup.close();
+    Users.remove(Meteor.userId());
     AccountsTemplates.logout();
-  },
+  }),
 });
 
 // XXX For some reason the useraccounts autofocus isnt working in this case.

+ 2 - 1
i18n/en.i18n.json

@@ -722,5 +722,6 @@
   "act-almostdue": "was reminding the current due (__timeValue__) of __card__ is approaching",
   "act-pastdue": "was reminding the current due (__timeValue__) of __card__ is past",
   "act-duenow": "was reminding the current due (__timeValue__) of __card__ is now",
-  "act-atUserComment": "You were mentioned in [__board__] __card__"
+  "act-atUserComment": "You were mentioned in [__board__] __card__",
+  "delete-user-confirm-popup": "Are you sure you want to delete this account? There is no undo."
 }