Commit fe245f2b7bc6c509f10ec98064f30e167882c5de
Committed by
Paulo Meireles
1 parent
9ed4b61a
Exists in
master
and in
29 other branches
partial for source tree
Showing
3 changed files
with
40 additions
and
28 deletions
Show diff stats
plugins/mezuro/lib/kalibro/entities/module_node.rb
@@ -6,6 +6,14 @@ class Kalibro::Entities::ModuleNode < Kalibro::Entities::Entity | @@ -6,6 +6,14 @@ 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 | + | ||
9 | def child=(value) | 17 | def child=(value) |
10 | @child = to_entity_array(value, Kalibro::Entities::ModuleNode) | 18 | @child = to_entity_array(value, Kalibro::Entities::ModuleNode) |
11 | end | 19 | end |
@@ -18,30 +26,4 @@ class Kalibro::Entities::ModuleNode < Kalibro::Entities::Entity | @@ -18,30 +26,4 @@ class Kalibro::Entities::ModuleNode < Kalibro::Entities::Entity | ||
18 | @child = children | 26 | @child = children |
19 | end | 27 | end |
20 | 28 | ||
21 | - def print | ||
22 | - cell = "<td>#{@module.name} (#{@module.granularity})</td>" | ||
23 | - return "<table><tr><td width=\"1\"></td>" + cell + "</tr></table>" if @child.nil? | ||
24 | - | ||
25 | - id = @module.name | ||
26 | - "<table>" + | ||
27 | - "<tr>" + | ||
28 | - "<td width=\"10%\">" + | ||
29 | - "<img id=\"#{id}_plus\" onclick=\"toogle('#{id}')\"" + | ||
30 | - "alt=\"+\" src=\"/plugins/mezuro/images/plus.png\" class=\"link\"" + | ||
31 | - "style=\"display: none\"/>" + | ||
32 | - "<img id=\"#{id}_minus\" onclick=\"toogle('#{id}')\"" + | ||
33 | - "alt=\"-\" src=\"/plugins/mezuro/images/minus.png\" class=\"link\"" + | ||
34 | - "/>" + | ||
35 | - "</td>" + | ||
36 | - cell + | ||
37 | - "</tr>" + | ||
38 | - "<tr id=\"#{id}_hidden\">" + | ||
39 | - "<td></td>" + | ||
40 | - "<td style=\"text-align: left\">" + | ||
41 | - @child.collect { |child| child.print }.to_s + | ||
42 | - "</td>" + | ||
43 | - "</tr>" + | ||
44 | - "</table>" | ||
45 | - end | ||
46 | - | ||
47 | -end | ||
48 | \ No newline at end of file | 29 | \ No newline at end of file |
30 | +end |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +<% if source_tree.children && !source_tree.children.empty? %> | ||
2 | + <table> | ||
3 | + <tr> | ||
4 | + <td width='10%'> | ||
5 | + <img id='<%= source_tree.module_name %>_plus' onclick="toogle('<%= source_tree.module_name %>')" | ||
6 | + alt='+' src='/plugins/mezuro/images/plus.png' class='link' | ||
7 | + style='display: none'/> | ||
8 | + <img id='<%= source_tree.module_name %>_minus' onclick="toogle('<%= source_tree.module_name %>')" | ||
9 | + alt='-' src='/plugins/mezuro/images/minus.png' class='link' | ||
10 | + /> | ||
11 | + </td> | ||
12 | + <td><%= source_tree.module_name %> (<%= source_tree.granularity %>)</td> | ||
13 | + </tr> | ||
14 | + <tr id='<%= source_tree.module_name %>_hidden'> | ||
15 | + <td></td> | ||
16 | + <td style='text-align: left'> | ||
17 | + <% source_tree.children.each do |child| %> | ||
18 | + <%= render :partial => 'source_tree', :locals => { :source_tree => child } %> | ||
19 | + <% end %> | ||
20 | + </td> | ||
21 | + </tr> | ||
22 | + </table> | ||
23 | +<% else %> | ||
24 | + <table> | ||
25 | + <tr> | ||
26 | + <td width='1'></td> | ||
27 | + <td><%= source_tree.module_name %> (<%= source_tree.granularity %>)</td> | ||
28 | + </tr> | ||
29 | + </table> | ||
30 | +<% end %> |
plugins/mezuro/views/content_viewer/show_project.rhtml
@@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
67 | </tr> | 67 | </tr> |
68 | </table> | 68 | </table> |
69 | <h5><%= _('Source tree') %></h5> | 69 | <h5><%= _('Source tree') %></h5> |
70 | - <%= @project_result.source_tree.print %> | 70 | + <%= render :partial => 'source_tree', :locals => { :source_tree => @project_result.source_tree } %> |
71 | 71 | ||
72 | <% @module_result = @page.module_result(@project.name) %> | 72 | <% @module_result = @page.module_result(@project.name) %> |
73 | 73 |