Commit 077442d454e215b7d454e6a47cbe92fff18a9d2a

Authored by Rafael Manzo
1 parent cbdb8c12

Source tree visualization github-like

plugins/mezuro/public/images/file.png 0 → 100644

534 Bytes

plugins/mezuro/public/images/folder.png 0 → 100644

3.31 KB

plugins/mezuro/public/style.css
1 1 .link {
2 2 cursor: pointer;
3   -}
4 3 \ No newline at end of file
  4 +}
  5 +
  6 +.source-tree{
  7 + background: #e7e7e7;
  8 + border: groove 1px #666;
  9 +}
  10 +
  11 +.icon {
  12 + width: 20px;
  13 +}
  14 +
  15 +.source-tree-text{
  16 + font-family: Arial, Impact;
  17 + font-size: 12px;
  18 + border-left: solid 1px #666;
  19 +}
  20 +
  21 +a:link,active,visited .ancestor{
  22 + font-family: Arial, Impact;
  23 + color: #5E5400;
  24 +}
  25 +
  26 +.path{
  27 + font-family: Arial, Impact;
  28 + font-size: 14px;
  29 + font-style: underline;
  30 + display: inline;
  31 +}
... ...
plugins/mezuro/views/content_viewer/_source_tree.rhtml
... ... @@ -2,28 +2,36 @@
2 2 <% module_name = source_tree.module.name %>
3 3 <% module_label = "#{module_name} (#{source_tree.module.granularity})" %>
4 4  
5   -<% if module_name != project_name %>
6   - <a href="#" class="source-tree-link" data-module-name="<%= project_name %>">
7   - <%= project_name %>
8   - </a>
9   -<% end %>
  5 +<p><h2 class="path">
  6 + <% if module_name != project_name %>
  7 + <a href="#" class="source-tree-link" data-module-name="<%= project_name %>">
  8 + <%= project_name %>
  9 + </a>
  10 + <% end %>
  11 +
10 12  
11 13 <% split_link = source_tree.module.ancestor_names %>
12 14 <% split_link.each do |link| %>
13   - <a href="#" class="source-tree-link" data-module-name="<%= link %>">
  15 + /<a href="#" class="source-tree-link" data-module-name="<%= link %>">
14 16 <%= link.split(".").last %>
15 17 </a>
16   -<% end %>
17   -
  18 + <% end %>
  19 +</h2></p>
  20 +
18 21 <% if source_tree.children %>
19   - <table>
  22 + <table border="0" class="source-tree">
20 23 <% source_tree.children.each do |child| %>
21   - <tr>
22   - <td>
23   - <a href='#' class="source-tree-link" data-module-name="<%= child.module.name %>">
24   - <%= "#{child.module.name} (#{child.module.granularity})" %>
25   - </td>
26   - </tr>
  24 + <% if child.module.granularity=='PACKAGE' %>
  25 + <tr>
  26 + <td class="icon"><%= image_tag('/plugins/mezuro/images/folder.png')%></td>
  27 + <td class="source-tree-text"><a href='#' class="source-tree-link" data-module-name="<%= child.module.name %>"><%= child.module.name %></a></td>
  28 + </tr>
  29 + <% else %>
  30 + <tr>
  31 + <td class="icon"><%= image_tag('/plugins/mezuro/images/file.png') %></td>
  32 + <td class="source-tree-text"><%= child.module.name %></td>
  33 + </tr>
  34 + <% end %>
27 35 <% end %>
28 36 </table>
29 37 <% end %>
... ...