Commit 2a4ebbf7a74536e8b12257266a1d1821cd675d0e
Committed by
Paulo Meireles
1 parent
087a62e6
Exists in
master
and in
29 other branches
[Mezuro] Added date selection form that reloads project result
Showing
3 changed files
with
25 additions
and
23 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
... | ... | @@ -16,23 +16,12 @@ class MezuroPluginProfileController < ProfileController |
16 | 16 | end |
17 | 17 | |
18 | 18 | def project_result |
19 | - | |
20 | - date = params[:date] | |
21 | 19 | |
22 | 20 | content = profile.articles.find(params[:id]) |
23 | 21 | project_result = content.project_result |
24 | 22 | project = content.project |
25 | - | |
26 | - if date_verify(date) | |
27 | - client = Kalibro::Client::ProjectResultClient.new | |
28 | - if client.has_results_before(project.name, date) | |
29 | - project_result = client.last_result_before(project.name, date) | |
30 | - end | |
31 | - end | |
32 | - history = project_history project | |
33 | - | |
34 | - render :partial => 'content_viewer/project_result', :locals => { :project_result => project_result, :history => history } | |
35 | - end | |
23 | + render :partial => 'content_viewer/project_result', :locals => { :project_result => project_result} | |
24 | + end | |
36 | 25 | |
37 | 26 | def module_result |
38 | 27 | content = profile.articles.find(params[:id]) |
... | ... | @@ -57,7 +46,6 @@ class MezuroPluginProfileController < ProfileController |
57 | 46 | @collector_name = params[:collector_name] |
58 | 47 | @collector = Kalibro::Client::BaseToolClient.new.base_tool(@collector_name) |
59 | 48 | end |
60 | - | |
61 | 49 | def new_metric_configuration |
62 | 50 | metric_name = params[:metric_name] |
63 | 51 | collector_name = params[:collector_name] |
... | ... | @@ -65,14 +53,12 @@ class MezuroPluginProfileController < ProfileController |
65 | 53 | @metric = collector.supported_metrics.find {|metric| metric.name == metric_name} |
66 | 54 | @configuration_name = params[:configuration_name] |
67 | 55 | end |
68 | - | |
69 | 56 | def edit_metric_configuration |
70 | 57 | metric_name = params[:metric_name] |
71 | 58 | @configuration_name = params[:configuration_name] |
72 | 59 | @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) |
73 | 60 | @metric = @metric_configuration.metric |
74 | 61 | end |
75 | - | |
76 | 62 | def create_metric_configuration |
77 | 63 | @configuration_name = params[:configuration_name] |
78 | 64 | metric_configuration = new_metric_configuration_instance |
... | ... | @@ -86,7 +72,6 @@ class MezuroPluginProfileController < ProfileController |
86 | 72 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) |
87 | 73 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" |
88 | 74 | end |
89 | - | |
90 | 75 | def new_range |
91 | 76 | @metric_name = params[:metric_name] |
92 | 77 | @configuration_name = params[:configuration_name] | ... | ... |
plugins/mezuro/public/javascripts/project_content.js
... | ... | @@ -2,6 +2,7 @@ var processingTree = false; |
2 | 2 | jQuery(function (){ |
3 | 3 | jQuery('.source-tree-link').live("click", reloadModule); |
4 | 4 | jQuery('[data-show]').live("click", toggle_mezuro); |
5 | + jQuery('#project_history_date').live("submit", reloadProjectWithDate); | |
5 | 6 | showLoadingProcess(true); |
6 | 7 | showProjectContent(); |
7 | 8 | }); |
... | ... | @@ -10,6 +11,11 @@ function showProjectContent() { |
10 | 11 | callAction('project_state', {}, showProjectContentFor); |
11 | 12 | } |
12 | 13 | |
14 | +function reloadProjectWithDate(){ | |
15 | + reloadProject(); | |
16 | + return false; | |
17 | +} | |
18 | + | |
13 | 19 | function toggle_mezuro(){ |
14 | 20 | var element = jQuery(this).attr('data-show'); |
15 | 21 | jQuery(element).toggle(); |
... | ... | @@ -25,11 +31,12 @@ function reloadModule(){ |
25 | 31 | return false; |
26 | 32 | } |
27 | 33 | |
28 | -function reloadProject(date){ | |
34 | +function reloadProject(){ | |
29 | 35 | showLoadingProcess(true); |
30 | - callAction('project_result', {date: date}, showProjectResult); | |
31 | - callAction('project_tree', {date: date}, showProjectTree); | |
32 | - callAction('module_result', {date: date}, showModuleResult); | |
36 | + | |
37 | + callAction('project_result', {}, showProjectResult); | |
38 | + callAction('project_tree', {}, showProjectTree); | |
39 | + callAction('module_result', {}, showModuleResult); | |
33 | 40 | } |
34 | 41 | |
35 | 42 | function showProjectContentFor(state){ |
... | ... | @@ -37,7 +44,7 @@ function showProjectContentFor(state){ |
37 | 44 | callAction('project_error', {}, showProjectResult); |
38 | 45 | else if (state == 'READY') { |
39 | 46 | callAction('project_result', {}, showProjectResult); |
40 | - callAction('project_tree', {}, showProjectTree); | |
47 | + //callAction('project_tree', {}, showProjectTree); | |
41 | 48 | var project_name = jQuery("#project-result").attr('data-project-name'); |
42 | 49 | callAction('module_result', {module_name: project_name}, showModuleResult); |
43 | 50 | } | ... | ... |
plugins/mezuro/views/content_viewer/_project_result.rhtml
1 | -Project history <%=select_tag "projectHistory",options_for_select(history), :onChange=>'reloadProject(this.value)'%> | |
1 | +Project history | |
2 | + | |
3 | +<% form_for :project_date, :html=>{:id=>"project_history_date"} do |f| %> | |
4 | + <%= f.text_field :day, :size => 1, :maxlength => 2 %> | |
5 | + <%= f.text_field :month, :size => 1, :maxlength => 2 %> | |
6 | + <%= f.text_field :year, :size => 1, :maxlength => 4 %> | |
7 | + <p> | |
8 | + <%= f.submit "Save" %> | |
9 | + </p> | |
10 | +<% end %> | |
11 | + | |
2 | 12 | |
3 | 13 | <h4><%= _('Result') %></h4> |
4 | 14 | ... | ... |