Permalink
Browse files

more of the class page implemented

  • Loading branch information...
1 parent 38be774 commit bbced04fa472aa80240efe63202d69ff22d7b7be @tenderlove committed Jul 13, 2010
Showing with 38 additions and 0 deletions.
  1. +29 −0 lib/app/views/classes/show.html.erb
  2. +6 −0 lib/rdoc/generator/horo.rb
  3. +3 −0 test/test_horo.rb
@@ -50,3 +50,32 @@
</head>
<body>
+<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
+ <td class="file-title"><span class="file-title-prefix"><%= klass.module? ? 'Module' : 'Class' %></span><br /><%= klass.full_name %></td>
+ <td align="right">
+ <table cellspacing="0" cellpadding="2">
+ <tr valign="top">
+ <td>In:</td>
+ <td>
+<% klass.in_files.each do |infile| %>
+<%= link_to infile.absolute_name, infile.path %>:
+<% end %>
+ </td>
+ </tr>
+<% if klass.type == 'class' %>
+ <tr>
+ <td>Parent:</td>
+ <td>
+
+ <% if String === klass.superclass %>
+ <%= klass.superclass %>
+ <% else %>
+ <%= link_to klass.aref_to klass.superclass.path, klass.superclass.full_name %>
+ <% end %>
+ </td>
+ </tr>
+<% end %>
+ </table>
+ </td>
+ </tr>
+ </table>
@@ -49,6 +49,7 @@ def write_classes
*File.dirname(klass.path).split(File::SEPARATOR).map { |x|
'..'
})
+ ctx.relative_prefix = relative_path
ctx.style_url = File.join relative_path, 'rdoc-style.css'
File.open(klass_file, 'wb') do |fh|
@@ -109,6 +110,11 @@ module FileIndexHelper
module ClassesHelper
attr_accessor :klass
attr_accessor :style_url
+ attr_accessor :relative_prefix
+
+ def link_to text, path
+ "<a href=\"#{File.join(relative_prefix, path)}\">#{text}</a>"
+ end
end
class TemplateContext < Struct.new :options, :files
View
@@ -60,6 +60,9 @@ def test_class_show
style_link = doc.css('link[rel = "stylesheet"]').first
assert_equal '../rdoc-style.css', style_link['href']
+
+ link = doc.css('a').find { |x| x.content == 'lib/horo.rb' }
+ assert_equal '../files/lib/horo_rb.html', link['href']
end
def teardown

0 comments on commit bbced04

Please sign in to comment.