1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

Serveur errors are not displayed nicely

This commit is contained in:
sam 2012-04-30 03:20:48 +07:00
parent a76e2e9a6f
commit 3a9d8d98ee

View File

@ -269,7 +269,7 @@ $('button[type=submit]').live("click", function(e){
$form = $('input, textarea, select, button').prop('disabled', true);
$form.prop('disabled', true);
$loading = $('form.well .progress').show();
$bar = $('form.well .progress').show();
var $loading = $('form.well .progress .bar')
.css('width', '25%')
.text('Converting paste to bits...');
@ -308,15 +308,22 @@ $('button[type=submit]').live("click", function(e){
})
.success(function(data) {
$loading.text('Redirecting to new paste...').css('width', '100%');
var paste_url = '/paste/' + data['paste'] + '#' + key;
zerobin.storatePaste(paste_url);
window.location = (paste_url);
if (data['status'] == 'error') {
zerobin.message('error', data['message'], 'Error');
$form.prop('disabled', false);
$bar.hide();
} else {
var paste_url = '/paste/' + data['paste'] + '#' + key;
zerobin.storatePaste(paste_url);
window.location = (paste_url);
}
});
}
);
} catch (err) {
$form.prop('disabled', false);
$loading.hide();
$bar.hide();
zerobin.message('error', 'Paste could not be encrypted. Aborting.',
'Error');
}