Adds javascript console logging for debug mode.

Fixes bug 988063.

Change-Id: I8b97d9259f69c069733b95d3f362e65a68ccdd7d
This commit is contained in:
Gabriel Hurley 2012-08-14 18:36:52 -07:00
parent f280caac40
commit 3e98b5b056
2 changed files with 8 additions and 3 deletions

View File

@ -44,9 +44,7 @@ horizon.datatables = {
$table.trigger("update");
break;
default:
if (horizon.conf.debug) {
horizon.alert("error", gettext("An error occurred while updating."));
}
horizon.utils.log(gettext("An error occurred while updating."));
$row.removeClass("ajax-update");
$row.find("i.ajax-updating").remove();
break;

View File

@ -1,5 +1,12 @@
/* Utilities for common needs which aren't JS builtins. */
horizon.utils = {
// Log function which checks for DEBUG and the existence of a console.
log: function (thing_to_log) {
if (horizon.conf.debug && typeof(console) !== "undefined" && typeof(console.log) !== "undefined") {
console.log(thing_to_log);
}
},
capitalize: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},