function add_dependency(module) { window.dashboard_dependencies = window.dashboard_dependencies || []; window.dashboard_dependencies.push(module); } function debug(msg) { if ("debug" in window) { if (window.debug === true) { console.log(msg); } } } function to_tag (value){ return value; } function to_image(value) { return value; //return { value, } } function to_datetime(value) { return value; } function to_boolean(value) { if (value) { return true; } return false; } /* * This function convert snake_type to CamelCase */ function camelCase(input) { return input.toLowerCase().replace(/(^(.)|_(.))/g, function(match, group1) { return group1.toUpperCase(); }).replace("_", ""); } /* * This function returns the currect path to a template */ function template(path){ //console.log(templates_path + path + ".html"); return templates_path + path + ".html"; } /* * This function returns the currect path to a template */ function template_url(path){ //console.log(templates_path + path + ".html"); return templates_path + path + ".html"; } /* * Check for page direction */ function is_ltr(){ return $("html").attr("dir") == "ltr" ? true : false; } /* * Return current language of page */ function current_language(){ return $("html").attr("lang"); } /* * Show subnav */ function show_subnav(){ $("#subnav").fadeIn(400); } /* * hide subnav */ function hide_subnav(){ } function success_message(msg){ show_flash_message(msg, "success"); } function warning_message(msg){ show_flash_message(msg, "warning"); } function error_message(msg){ show_flash_message(msg, "error"); } function show_error_queue(){ if (ErrorQueue.length > 0) { error_message(window.ErrorQueue.join("
")); } } /* * Catch the remote api error */ function catch_error1(error){ if (error.data.error) { console.log(error.data.error); error_message(error.data.error); } else { console.log("Translate catch_error"); error_message("Unkown error: please try again or contact to administrator."); } }; $(function(){ $("#flash").on("click", hide_flash); show_error_queue(); });