Enhance user creation (avoid create+delete row), clear create user form after action
This commit is contained in:
parent
43978abd80
commit
5962a0d4ac
|
@ -167,6 +167,19 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
var password=$('#newuserpassword').val();
|
var password=$('#newuserpassword').val();
|
||||||
var groups=$('#newusergroups').prev().children('div').data('settings').checked;
|
var groups=$('#newusergroups').prev().children('div').data('settings').checked;
|
||||||
|
$('#newuser').get(0).reset();
|
||||||
|
$.post(
|
||||||
|
OC.filePath('settings','ajax','createuser.php'),
|
||||||
|
{
|
||||||
|
username:username,
|
||||||
|
password:password,
|
||||||
|
groups:groups,
|
||||||
|
},
|
||||||
|
function(result){
|
||||||
|
if(result.status!='success'){
|
||||||
|
OC.dialogs.alert(result.data.message, 'Error creating user');
|
||||||
|
}
|
||||||
|
else {
|
||||||
var tr=$('#content table tbody tr').first().clone();
|
var tr=$('#content table tbody tr').first().clone();
|
||||||
tr.attr('data-uid',username);
|
tr.attr('data-uid',username);
|
||||||
tr.find('td.name').text(username);
|
tr.find('td.name').text(username);
|
||||||
|
@ -193,17 +206,6 @@ $(document).ready(function(){
|
||||||
tr.find('select.quota option').attr('selected',null);
|
tr.find('select.quota option').attr('selected',null);
|
||||||
tr.find('select.quota option').first().attr('selected','selected');
|
tr.find('select.quota option').first().attr('selected','selected');
|
||||||
tr.find('select.quota').data('previous','default');
|
tr.find('select.quota').data('previous','default');
|
||||||
$.post(
|
|
||||||
OC.filePath('settings','ajax','createuser.php'),
|
|
||||||
{
|
|
||||||
username:username,
|
|
||||||
password:password,
|
|
||||||
groups:groups,
|
|
||||||
},
|
|
||||||
function(result){
|
|
||||||
if(result.status!='success'){
|
|
||||||
tr.remove();
|
|
||||||
OC.dialogs.alert(result.data.message, 'Error creating user');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue