<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>
});
};
- 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;
});
};
+ 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();