Sha256: f0a88f34f11d89c6f7847130672b1ea7514a22264c6537218e347f5ea9210f95

Contents?: true

Size: 1.9 KB

Versions: 18

Compression:

Stored size: 1.9 KB

Contents

function debug(msg) {
    if ("debug" in window) {
        if (window.debug === true) {
            console.log(msg);
        }
    }
}

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";
}

/*
 * 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("<br/>"));
    }
}

/*
 * 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();
});

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
faalis-0.26.3 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.26.2 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.26.1 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.26.0 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.25.1 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.25.0 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.24.4 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.24.3 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.24.2 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.24.0 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.23.0 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.22.0 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.21.1 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.21.0 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.20.0 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.19.0 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.18.1 app/assets/javascripts/faalis/dashboard/functions.js.erb
faalis-0.18.0 app/assets/javascripts/faalis/dashboard/functions.js.erb