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); showProjectContent(); }); function showProjectContent() { callAction('project', 'project_state', {}, showProjectContentFor); } 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 module_name = jQuery(this).attr('data-module-name'); showLoadingProcess(false); processingTree = true; callAction('project', 'project_tree', {module_name: module_name }, showProjectTree); callAction('module', 'module_result', {module_name: module_name}, showModuleResult); return false; } function reloadProjectWithDate(date){ reloadProject(date + "T00:00:00+00:00"); return false; } function reloadProject(date){ showLoadingProcess(true); callAction('project', 'project_result', {date: date}, showProjectResult); callAction('project', 'project_tree', {date: date}, showProjectTree); callAction('module', 'module_result', {date: date}, showModuleResult); } function showProjectContentFor(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();
}