Commit de7fc6f7afcdc8856082eea24a960d94fd9feb20
Committed by
Diego Camarinha
1 parent
259f3e87
Exists in
master
and in
29 other branches
[Mezuro] Finished source tree navegation
Showing
3 changed files
with
20 additions
and
3 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
| @@ -18,12 +18,13 @@ class MezuroPluginProfileController < ProfileController | @@ -18,12 +18,13 @@ class MezuroPluginProfileController < ProfileController | ||
| 18 | def project_result | 18 | def project_result |
| 19 | content = profile.articles.find(params[:id]) | 19 | content = profile.articles.find(params[:id]) |
| 20 | project_result = content.project_result | 20 | project_result = content.project_result |
| 21 | + project = content.project | ||
| 21 | if params[:module_name].nil? | 22 | if params[:module_name].nil? |
| 22 | source_tree = project_result.source_tree | 23 | source_tree = project_result.source_tree |
| 23 | else | 24 | else |
| 24 | source_tree = project_result.get_node(params[:module_name]) | 25 | source_tree = project_result.get_node(params[:module_name]) |
| 25 | end | 26 | end |
| 26 | - render :partial => 'content_viewer/project_result', :locals => { :project_result => project_result, :source_tree => source_tree } | 27 | + render :partial => 'content_viewer/project_result', :locals => { :project_result => project_result, :source_tree => source_tree, :project => project } |
| 27 | end | 28 | end |
| 28 | 29 | ||
| 29 | def module_result | 30 | def module_result |
plugins/mezuro/views/content_viewer/_project_result.rhtml
| @@ -14,6 +14,21 @@ | @@ -14,6 +14,21 @@ | ||
| 14 | <td><%= project_result.formatted_analysis_time %></td> | 14 | <td><%= project_result.formatted_analysis_time %></td> |
| 15 | </tr> | 15 | </tr> |
| 16 | </table> | 16 | </table> |
| 17 | - | ||
| 18 | <h4><%= _('Source tree') %></h4> | 17 | <h4><%= _('Source tree') %></h4> |
| 19 | -<%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => source_tree } %> | 18 | + |
| 19 | +<% if !source_tree.nil? && project.name != source_tree.module.name %> | ||
| 20 | + <a href="#" class="module-result-link" data-module-name="<%= project_result.source_tree %>"> | ||
| 21 | + <%= project.name %> | ||
| 22 | + </a> | ||
| 23 | + <% split_link = source_tree.module.ancestor_names %> | ||
| 24 | + <% split_link.each do |link| %> | ||
| 25 | + <% if split_link.length - 1 != split_link.index(link) %> | ||
| 26 | + <a href="#" class="module-result-link" data-module-name="<%= link %>"> | ||
| 27 | + <%= link %> | ||
| 28 | + </a> | ||
| 29 | + <% end %> | ||
| 30 | + <% end %> | ||
| 31 | + <%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => source_tree } %> | ||
| 32 | +<% else %> | ||
| 33 | + <%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => project_result.source_tree } %> | ||
| 34 | +<% end %> |
plugins/mezuro/views/content_viewer/_source_tree.rhtml
| 1 | <% module_name = source_tree.module.name %> | 1 | <% module_name = source_tree.module.name %> |
| 2 | <% module_label = "#{module_name} (#{source_tree.module.granularity})" %> | 2 | <% module_label = "#{module_name} (#{source_tree.module.granularity})" %> |
| 3 | + | ||
| 3 | <% if source_tree.children %> | 4 | <% if source_tree.children %> |
| 4 | <table> | 5 | <table> |
| 5 | <tr> | 6 | <tr> |