Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Romanov authored Jun 16, 2016
1 parent c853468 commit 3ed83ea
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
$(window).on('ajaxErrorMessage', function(event, message){
event.preventDefault();
/*if(document.flashflag){
document.romanov_flashoptions.message = message;
document.romanov_flashsettings.type = 'danger';
$.notify(document.romanov_flashoptions, document.romanov_flashsettings);
}else{
$.notify({
message: message
},{
type: 'danger',
placement: {
from: "top",
align: "center"
},
delay: 10000
});
}*/
});

$(window).on('ajaxError', function(event, obj, context, status) {
var message;
var showfm = function(message){
if(document.flashflag){
document.romanov_flashoptions.message = message[key][0];
document.romanov_flashoptions.message = message;
document.romanov_flashsettings.type = 'danger';
$.notify(document.romanov_flashoptions, document.romanov_flashsettings);
}else{
$.notify({
message: message[key][0]
message: message
},{
type: 'danger',
placement: {
Expand All @@ -21,17 +37,24 @@ $(window).on('ajaxError', function(event, obj, context, status) {
delay: 10000
});
}
}
};
if (typeof status.responseJSON === 'undefined') {
message = status.responseText.match(/^\"(.*)\"\s/)[1];
if (typeof status.responseText !== 'undefined') {
message = status.responseText.match(/^\"(.*)\"\s/);
if (message && typeof message[1] !== 'undefined') {
message = message[1];
} else {
message = status.responseText;
}
}
} else {
message = status.responseJSON.X_OCTOBER_ERROR_FIELDS;
}
if( typeof message === 'object' ) {
for (var key in message) {
showfm(message);
}
}else{
$.each(message, function(){
showfm(this[0]);
});
}else if(typeof message !== 'undefined'){
showfm(message);
}
});
Expand All @@ -49,4 +72,4 @@ $(document).ready(function(){
}
}
});
});
});

0 comments on commit 3ed83ea

Please sign in to comment.