var processingTree = false; var metricName; jQuery(function (){ jQuery('.source-tree-link').live("click", reloadModule); jQuery('[show-metric-history]').live("click", display_metric_history); jQuery('[show-grade-history]').live("click", display_grade_history); jQuery('#project_date_submit').live("click", reloadProjectWithDate); showLoadingProcess(true); showProcessing(); }); function showProcessing() { callAction('processing', 'processing_state', {}, showProcessingFor); } function display_metric_history() { var module_name = jQuery(this).attr('data-module-name'); var metric_name = jQuery(this).attr('show-metric-history'); toggle_mezuro("." + metric_name); metricName = metric_name; callAction('module', 'module_metrics_history', {module_id: module_id, module_result_id: module_result_id}, show_metrics); return false; } function display_grade_history() { var module_name = jQuery(this).attr('data-module-name'); toggle_mezuro("#historical-grade"); callAction('module', 'module_grade_history', {module_name: module_name}, show_grades); return false; } function show_metrics(content) { jQuery('#historical-' + metricName).html(content); } function show_grades(content) { jQuery('#historical-grade').html(content); } function toggle_mezuro(element){ jQuery(element).toggle(); return false; } function reloadModule(){ var results_root_id = jQuery(this).attr('results_root_id'); showLoadingProcess(false); processingTree = true; callAction('module_result', 'project_tree', {results_root_id: results_root_id }, showProjectTree); callAction('module_result', 'module_result', {results_root_id: results_root_id}, showModuleResult); return false; } function reloadProjectWithDate(date){ reloadProject(date + "T00:00:00+00:00"); return false; } function reloadProject(date){ showLoadingProcess(true); callAction('processing', 'processing', {date: date}, showProjectResult); callAction('module_result', 'project_tree', {date: date}, showProjectTree); callAction('module_result', 'module_result', {date: date}, showModuleResult); } function showProcessingFor(state){ if (state == 'ERROR') { jQuery('#project-state').html('
");
showProjectTree("
");
showModuleResult("
");
}
function sourceNodeToggle(id){
var suffixes = ['_hidden', '_plus', '_minus'];
for (var i in suffixes)
jQuery('#' + id + suffixes[i]).toggle();
}