Use the notification instead of the disruptive popup

This commit is contained in:
Joas Schilling 2016-02-22 09:17:59 +01:00
parent 8a8209796d
commit 04da5a56dd
2 changed files with 18 additions and 16 deletions

View file

@ -142,8 +142,8 @@ GroupList = {
.text(result.groupname));
}
GroupList.toggleAddGroup();
}).fail(function(result, textStatus, errorThrown) {
OC.dialogs.alert(result.responseJSON.message, t('settings', 'Error creating group'));
}).fail(function(result) {
OC.Notification.showTemporary(t('settings', 'Error creating group: {message}', {message: result.responseJSON.message}));
});
},
@ -245,9 +245,9 @@ GroupList = {
isGroupNameValid: function (groupname) {
if ($.trim(groupname) === '') {
OC.dialogs.alert(
t('settings', 'A valid group name must be provided'),
t('settings', 'Error creating group'));
OC.Notification.showTemporary(t('settings', 'Error creating group: {message}', {
message: t('settings', 'A valid group name must be provided')
}));
return false;
}
return true;

View file

@ -767,24 +767,24 @@ $(document).ready(function () {
var password = $('#newuserpassword').val();
var email = $('#newemail').val();
if ($.trim(username) === '') {
OC.dialogs.alert(
t('settings', 'A valid username must be provided'),
t('settings', 'Error creating user'));
OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', {
message: t('settings', 'A valid username must be provided')
}));
return false;
}
if ($.trim(password) === '') {
OC.dialogs.alert(
t('settings', 'A valid password must be provided'),
t('settings', 'Error creating user'));
OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', {
message: t('settings', 'A valid password must be provided')
}));
return false;
}
if(!$('#CheckboxMailOnUserCreate').is(':checked')) {
email = '';
}
if ($('#CheckboxMailOnUserCreate').is(':checked') && $.trim(email) === '') {
OC.dialogs.alert(
t('settings', 'A valid email must be provided'),
t('settings', 'Error creating user'));
OC.Notification.showTemporary( t('settings', 'Error creating user: {message}', {
message: t('settings', 'A valid email must be provided')
}));
return false;
}
@ -822,8 +822,10 @@ $(document).ready(function () {
}
$('#newusername').focus();
GroupList.incEveryoneCount();
}).fail(function(result, textStatus, errorThrown) {
OC.dialogs.alert(result.responseJSON.message, t('settings', 'Error creating user'));
}).fail(function(result) {
OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', {
message: result.responseJSON.message
}));
}).success(function(){
$('#newuser').get(0).reset();
});