Commit 787caaa4cc6a1104e9b88c92ee8407d20599f279

Authored by Carlos Morais
1 parent 0b2a3843

[Mezuro] Refactoring

plugins/mezuro/lib/kalibro/entities/module_node.rb
@@ -6,14 +6,6 @@ class Kalibro::Entities::ModuleNode < Kalibro::Entities::Entity @@ -6,14 +6,6 @@ class Kalibro::Entities::ModuleNode < Kalibro::Entities::Entity
6 @module = to_entity(value, Kalibro::Entities::Module) 6 @module = to_entity(value, Kalibro::Entities::Module)
7 end 7 end
8 8
9 - def module_name  
10 - @module.name  
11 - end  
12 -  
13 - def granularity  
14 - @module.granularity  
15 - end  
16 -  
17 def child=(value) 9 def child=(value)
18 @child = to_entity_array(value, Kalibro::Entities::ModuleNode) 10 @child = to_entity_array(value, Kalibro::Entities::ModuleNode)
19 end 11 end
plugins/mezuro/public/javascripts/results.js
@@ -4,7 +4,7 @@ function results($) { @@ -4,7 +4,7 @@ function results($) {
4 4
5 function show_module_result(){ 5 function show_module_result(){
6 var profile = jQuery('#module-result').attr('data-profile'); 6 var profile = jQuery('#module-result').attr('data-profile');
7 - var project = jQuery('#module-result').attr('data-project-id'); 7 + var project = jQuery('#module-result').attr('data-content');
8 var module_name = jQuery(this).attr('data-module-name'); 8 var module_name = jQuery(this).attr('data-module-name');
9 var endpoint = '/profile/' + profile + '/plugins/mezuro/module_result/' + project; 9 var endpoint = '/profile/' + profile + '/plugins/mezuro/module_result/' + project;
10 show_loading_message(module_name); 10 show_loading_message(module_name);
plugins/mezuro/views/content_viewer/_project_result.rhtml
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -<% @project_result = content.project_result %>  
2 -  
3 -<h3><%= _('LAST RESULT') %></h3>  
4 -  
5 -<table>  
6 - <tr>  
7 - <td><%= _('Date') %></td>  
8 - <td><%= @project_result.date %></td>  
9 - </tr>  
10 - <tr>  
11 - <td><%= _('Load time') %></td>  
12 - <td><%= @project_result.formatted_load_time %></td>  
13 - </tr>  
14 - <tr>  
15 - <td><%= _('Analysis time') %></td>  
16 - <td><%= @project_result.formatted_analysis_time %></td>  
17 - </tr>  
18 -</table>  
19 -  
20 -<h4><%= _('Source tree') %></h4>  
21 -<%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => @project_result.source_tree } %>  
22 -  
23 -<div id='module-result' data-profile="<%= content.profile.identifier %>" data-content='<%= content.id %>'>  
24 - <%= render :partial => 'content_viewer/module_result', :locals => { :module_result => content.module_result(content.project.name) } %>  
25 -</div>  
26 -  
27 -<script type="text/javascript">  
28 - jQuery(results);  
29 -</script>  
30 \ No newline at end of file 0 \ No newline at end of file
plugins/mezuro/views/content_viewer/_source_tree.rhtml
1 -<% module_name = source_tree.module_name %>  
2 -<% module_label = "#{module_name} (#{source_tree.granularity})" %> 1 +<% module_name = source_tree.module.name %>
  2 +<% module_label = "#{module_name} (#{source_tree.module.granularity})" %>
3 <% if source_tree.children %> 3 <% if source_tree.children %>
4 <table> 4 <table>
5 <tr> 5 <tr>
6 <td width="10%"> 6 <td width="10%">
7 <img alt="+" src="/plugins/mezuro/images/plus.png" class="link" 7 <img alt="+" src="/plugins/mezuro/images/plus.png" class="link"
8 - id="<%= module_name %>_plus" onclick="toggle('<%= module_name %>')"/> 8 + id="<%= module_name %>_plus" onclick="toggle('<%= module_name %>')" style="display: none"/>
9 <img alt="-" src="/plugins/mezuro/images/minus.png" class="link" 9 <img alt="-" src="/plugins/mezuro/images/minus.png" class="link"
10 - id="<%= module_name %>_minus" onclick="toggle('<%= module_name %>')" style="display: none"/> 10 + id="<%= module_name %>_minus" onclick="toggle('<%= module_name %>')"/>
11 </td> 11 </td>
12 <td> 12 <td>
13 <a href="#" class="module-result-link" data-module-name="<%= module_name %>"> 13 <a href="#" class="module-result-link" data-module-name="<%= module_name %>">
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 </a> 15 </a>
16 </td> 16 </td>
17 </tr> 17 </tr>
18 - <tr id="<%= module_name %>_hidden" style="display: none"> 18 + <tr id="<%= module_name %>_hidden">
19 <td></td> 19 <td></td>
20 <td style="text-align: left"> 20 <td style="text-align: left">
21 <% source_tree.children.each do |child| %> 21 <% source_tree.children.each do |child| %>
plugins/mezuro/views/content_viewer/show_project.rhtml
@@ -45,5 +45,33 @@ @@ -45,5 +45,33 @@
45 <% elsif @project.state.end_with?('ING') %> 45 <% elsif @project.state.end_with?('ING') %>
46 <h3><%= _('Service is ') + @project.state.downcase + ' ' + @project.name + '...' %></h3> 46 <h3><%= _('Service is ') + @project.state.downcase + ' ' + @project.name + '...' %></h3>
47 <% elsif @project.state == 'READY' %> 47 <% elsif @project.state == 'READY' %>
48 - <%= render :partial => 'content_viewer/project_result', :locals => { :content => @page } %> 48 + <% @project_result = @page.project_result %>
  49 +
  50 + <h3><%= _('LAST RESULT') %></h3>
  51 +
  52 + <table>
  53 + <tr>
  54 + <td><%= _('Date') %></td>
  55 + <td><%= @project_result.date %></td>
  56 + </tr>
  57 + <tr>
  58 + <td><%= _('Load time') %></td>
  59 + <td><%= @project_result.formatted_load_time %></td>
  60 + </tr>
  61 + <tr>
  62 + <td><%= _('Analysis time') %></td>
  63 + <td><%= @project_result.formatted_analysis_time %></td>
  64 + </tr>
  65 + </table>
  66 +
  67 + <h4><%= _('Source tree') %></h4>
  68 + <%= render :partial => 'source_tree', :locals => { :source_tree => @project_result.source_tree } %>
  69 +
  70 + <div id='module-result' data-profile="<%= @page.profile.identifier %>" data-content='<%= @page.id %>'>
  71 + <%= render :partial => 'module_result', :locals => { :module_result => @page.module_result(@project.name) } %>
  72 + </div>
  73 +
  74 + <script type="text/javascript">
  75 + jQuery(results);
  76 + </script>
49 <% end %> 77 <% end %>
50 \ No newline at end of file 78 \ No newline at end of file