You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
997 B
39 lines
997 B
var lib_msg = {
|
|
// Extracts jqxhr error message
|
|
extractJqxhrErrorMsg: function(jqxhr) {
|
|
let hasErrorMsg = ('responseJSON' in jqxhr) &&
|
|
(jqxhr['responseJSON'] != null) &&
|
|
('message' in jqxhr['responseJSON']);
|
|
|
|
return hasErrorMsg ? jqxhr['responseJSON']['message'] : jqxhr.statusText;
|
|
},
|
|
|
|
// UI functions
|
|
addTextinID: function(text, id){
|
|
$(id).html(text.toUpperCase());
|
|
},
|
|
|
|
displayMessage: function(text){
|
|
this.addTextinID('', '#errors');
|
|
this.addTextinID('', '#info');
|
|
this.addTextinID(text, '#msg');
|
|
},
|
|
|
|
displayErrors: function(text){
|
|
this.addTextinID('', '#msg');
|
|
this.addTextinID('', '#info');
|
|
this.addTextinID(text, '#errors');
|
|
},
|
|
|
|
displayInfo: function(text){
|
|
this.addTextinID('', '#msg');
|
|
this.addTextinID('', '#errors');
|
|
this.addTextinID(text, '#info');
|
|
},
|
|
|
|
cleanMessagesUi: function() {
|
|
this.addTextinID('', '#msg');
|
|
this.addTextinID('', '#errors');
|
|
this.addTextinID('', '#info');
|
|
}
|
|
}
|