]> source.dussan.org Git - archiva.git/commitdiff
fix delete user
authorOlivier Lamy <olamy@apache.org>
Thu, 2 Feb 2012 20:43:44 +0000 (20:43 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 2 Feb 2012 20:43:44 +0000 (20:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1239832 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/user-grids.html
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/user.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/users.js

index 8a38f604108dbbaad393a8411f4d727bf7c7f8a6..deb8bc9e4a9dba9f57420c38746f955f7c0e62a8 100644 (file)
@@ -39,7 +39,7 @@
                 <td></td>
               {{else}}
                 <td>
-                  <a href="#" data-bind="click: function(){ row.deleteUser() }" id="users-grid-delete-${row.username()}">
+                  <a href="#" data-bind="click: function(){ deleteUser(row) }" id="users-grid-delete-${row.username()}">
                     <img src="images/edit-cut.png" alt="${$.i18n.prop('delete')}"/>
                   </a>
                 </td>
index c857b0a19f9b9a88e16be4586029f76582d52e9d..f98594e4b67c228f016b4a506d935b4c30aa42ef 100644 (file)
@@ -137,32 +137,6 @@ $(function() {
           });
       };
 
-      this.deleteUser=function() {
-        clearUserMessages();
-
-        var currentUser = this;
-        openDialogConfirm(function(){
-          $.ajax("restServices/redbackServices/userService/deleteUser/"+encodeURIComponent(currentUser.username()), {
-                type: "GET",
-                dataType: 'json',
-                success: function(data) {
-                  // FIXME i18n
-                  window.redbackModel.usersViewModel.users.remove(currentUser);
-                  displaySuccessMessage("user " + currentUser.username() + " deleted");
-                },
-                error: function(result) {
-                 var obj = jQuery.parseJSON(result.responseText);
-                 displayRedbackError(obj);
-                },
-                complete: function() {
-                  closeDialogConfirm();
-                }
-              }
-            );
-          }
-          ,"Ok", $.i18n.prop("cancel"), $.i18n.prop("user.delete.message") + ": " + currentUser.username());
-
-      };
 
       this.update=function(){
         var currentUser = this;
index c70e6819b58e6bf972a9da4f6db5613022b8983a..8f51fc4742bdca410e97f1d1cfbfb271b1bf461d 100644 (file)
@@ -94,6 +94,33 @@ $(function() {
       });
     };
 
+    deleteUser=function(user){
+      clearUserMessages();
+
+      var currentUser = user;
+      openDialogConfirm(function(){
+        $.ajax("restServices/redbackServices/userService/deleteUser/"+encodeURIComponent(currentUser.username()), {
+              type: "GET",
+              dataType: 'json',
+              success: function(data) {
+                // FIXME i18n
+                displaySuccessMessage("user " + currentUser.username() + " deleted");
+                self.users.remove(currentUser);
+              },
+              error: function(result) {
+               var obj = jQuery.parseJSON(result.responseText);
+               displayRedbackError(obj);
+              },
+              complete: function() {
+                closeDialogConfirm();
+              }
+            }
+          );
+        }
+        ,"Ok", $.i18n.prop("cancel"), $.i18n.prop("user.delete.message") + ": " + currentUser.username());
+
+    }
+
     editUserBox=function(user) {
       clearUserMessages();
       activateUsersEditTab();