Sha256: 2b0454a67d7dcb9a87544db59aaefb8a4f1a5c5fc4effc525780eb1f06cfefd1

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

function debug(msg) {
    if (window.debug) {
        console.log(msg);
    }
}

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

1 entries across 1 versions & 1 rubygems

Version Path
faalis-0.15.0 app/assets/javascripts/faalis/dashboard/functions.js.erb