From fe245f2b7bc6c509f10ec98064f30e167882c5de Mon Sep 17 00:00:00 2001 From: Antonio Terceiro + Carlos Morais Date: Fri, 27 Jan 2012 15:50:00 +0300 Subject: [PATCH] partial for source tree --- plugins/mezuro/lib/kalibro/entities/module_node.rb | 36 +++++++++--------------------------- plugins/mezuro/views/content_viewer/_source_tree.rhtml | 30 ++++++++++++++++++++++++++++++ plugins/mezuro/views/content_viewer/show_project.rhtml | 2 +- 3 files changed, 40 insertions(+), 28 deletions(-) create mode 100644 plugins/mezuro/views/content_viewer/_source_tree.rhtml diff --git a/plugins/mezuro/lib/kalibro/entities/module_node.rb b/plugins/mezuro/lib/kalibro/entities/module_node.rb index 72e4005..4ca81a6 100644 --- a/plugins/mezuro/lib/kalibro/entities/module_node.rb +++ b/plugins/mezuro/lib/kalibro/entities/module_node.rb @@ -6,6 +6,14 @@ class Kalibro::Entities::ModuleNode < Kalibro::Entities::Entity @module = to_entity(value, Kalibro::Entities::Module) end + def module_name + @module.name + end + + def granularity + @module.granularity + end + def child=(value) @child = to_entity_array(value, Kalibro::Entities::ModuleNode) end @@ -18,30 +26,4 @@ class Kalibro::Entities::ModuleNode < Kalibro::Entities::Entity @child = children end - def print - cell = "#{@module.name} (#{@module.granularity})" - return "" + cell + "
" if @child.nil? - - id = @module.name - "" + - "" + - "" + - cell + - "" + - "" + - "" + - "" + - "" + - "
" + - "" + - "" + - "
" + - @child.collect { |child| child.print }.to_s + - "
" - end - -end \ No newline at end of file +end diff --git a/plugins/mezuro/views/content_viewer/_source_tree.rhtml b/plugins/mezuro/views/content_viewer/_source_tree.rhtml new file mode 100644 index 0000000..e62f146 --- /dev/null +++ b/plugins/mezuro/views/content_viewer/_source_tree.rhtml @@ -0,0 +1,30 @@ +<% if source_tree.children && !source_tree.children.empty? %> + + + + + + + + + +
+ + - + <%= source_tree.module_name %> (<%= source_tree.granularity %>)
+ <% source_tree.children.each do |child| %> + <%= render :partial => 'source_tree', :locals => { :source_tree => child } %> + <% end %> +
+<% else %> + + + + + +
<%= source_tree.module_name %> (<%= source_tree.granularity %>)
+<% end %> diff --git a/plugins/mezuro/views/content_viewer/show_project.rhtml b/plugins/mezuro/views/content_viewer/show_project.rhtml index 8a5f53f..74b20f9 100644 --- a/plugins/mezuro/views/content_viewer/show_project.rhtml +++ b/plugins/mezuro/views/content_viewer/show_project.rhtml @@ -67,7 +67,7 @@
<%= _('Source tree') %>
- <%= @project_result.source_tree.print %> + <%= render :partial => 'source_tree', :locals => { :source_tree => @project_result.source_tree } %> <% @module_result = @page.module_result(@project.name) %> -- libgit2 0.21.2