From 18bdf609c390f116a5b947ac2371d3e3983189a1 Mon Sep 17 00:00:00 2001 From: Diego Araújo + Renan Teruo Date: Fri, 13 Apr 2012 16:05:03 -0300 Subject: [PATCH] [Mezuro] Created new partial metric history and started to link controller with JavaScript. --- plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb | 7 ++++++- plugins/mezuro/public/javascripts/project_content.js | 15 +++++++++++++++ plugins/mezuro/views/content_viewer/_module_result.rhtml | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb index d3ce4e8..4c1342c 100644 --- a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb +++ b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb @@ -125,11 +125,16 @@ class MezuroPluginProfileController < ProfileController end def module_metrics_history + metric_name = params[:metric_name] + for i in 1..50 do + puts metric_name + end content = profile.articles.find(params[:id]) module_history = content.result_history(content.project.name, params[:module_name]) + metric_history = module_history.select { |x| x.metric_result.metric.name == metric_name} #precisamos que uma variável receba um array com os valores da métrica passada a partir do result history - render :partial => 'content_viewer/show_history', :locals => {:module_history => module_history } + render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history } end end diff --git a/plugins/mezuro/public/javascripts/project_content.js b/plugins/mezuro/public/javascripts/project_content.js index af4466b..9e4fd53 100644 --- a/plugins/mezuro/public/javascripts/project_content.js +++ b/plugins/mezuro/public/javascripts/project_content.js @@ -2,6 +2,8 @@ var processingTree = false; jQuery(function (){ jQuery('.source-tree-link').live("click", reloadModule); jQuery('[data-show]').live("click", toggle_mezuro); + //alert('AAAASDFAGSGDRSAFGHADFGSDFGSD'); + jQuery('[show-metric-history]').live("click", display_metric_history); showLoadingProcess(true); showProjectContent(); }); @@ -10,6 +12,19 @@ function showProjectContent() { callAction('project_state', {}, showProjectContentFor); } +function display_metric_history() { + var module_name = jQuery(this).attr('data-module-name'); + var metric_name = jQuery(this).attr('data-metric-name'); + alert (metric_name); + callAction('module_metrics_history', {module_name: module_name, metric_name: metric_name}, show_metrics)//metric_name, module_name}, show_metrics); +} + +function show_metrics(content) { + alert('SSSSSSSSSSS'); + jQuery('#historical').html(content); + +} + function toggle_mezuro(){ var element = jQuery(this).attr('data-show'); jQuery(element).toggle(); diff --git a/plugins/mezuro/views/content_viewer/_module_result.rhtml b/plugins/mezuro/views/content_viewer/_module_result.rhtml index a367ebf..19559df 100644 --- a/plugins/mezuro/views/content_viewer/_module_result.rhtml +++ b/plugins/mezuro/views/content_viewer/_module_result.rhtml @@ -32,7 +32,9 @@ <%= range.nil? or range.comments.nil? ? 'comment empty' : range.comments %> -

Draw Historical Graphic

+
+ " data-module-name="<%= the_module.name %>" data-metric-name="<%= metric_result.metric.name.delete("() ") %>">

Draw Historical Graphic

+
<%= range.comments.nil? ? '' : range.comments %> -- libgit2 0.21.2