/* ----------------------------------------------------------------------------- Red Base - Basic website skel engine Copyright (C) 2012-2013 Yellowen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ----------------------------------------------------------------------------- */ function can(action, model) { console.log(">>>>>>>>>>>>"); } /* * 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"; } /* * Check for page direction */ function is_ltr(){ return $("html").attr("dir") == "ltr" ? true : false; } /* * Show subnav */ function show_subnav(){ $("#subnav").fadeIn(400); } /* * hide subnav */ function hide_subnav(){ } function show_flash_message(msg, klass) { var flash = $("#flash"); $(flash).find("div").html(msg); $(flash).removeClass().addClass("row").addClass(klass).fadeIn(700).delay(5000).fadeOut(500); } function hide_flash() { $("#flash").hide(); } 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(); });