Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more of the class page implemented

  • Loading branch information...
commit bbced04fa472aa80240efe63202d69ff22d7b7be 1 parent 38be774
@tenderlove authored
View
29 lib/app/views/classes/show.html.erb
@@ -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>
View
6 lib/rdoc/generator/horo.rb
@@ -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
3  test/test_horo.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.