-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #872 from nobu/index-details
Fold "class and module index" list
- Loading branch information
Showing
3 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
30 changes: 27 additions & 3 deletions
30
lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
<div id="classindex-section" class="nav-section"> | ||
<h3>Class and Module Index</h3> | ||
|
||
<%- | ||
all_classes = @classes.group_by do |klass| | ||
klass.full_name[/\A[^:]++(?:::[^:]++(?=::))*+(?=::[^:]*+\z)/] | ||
end.delete_if do |_, klasses| | ||
!klasses.any?(&:display?) | ||
end | ||
link = proc do |index_klass, display = index_klass.display?| | ||
if display | ||
-%><code><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.name %></a></code><%- | ||
else | ||
-%><code><%= index_klass.name %></code><%- | ||
end | ||
end | ||
if top = all_classes[nil] | ||
solo = top.one? {|klass| klass.display?} | ||
traverse = proc do |klasses| -%> | ||
<ul class="link-list"> | ||
<%- @modsort.each do |index_klass| -%> | ||
<li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a> | ||
<%- klasses.each do |index_klass| -%> | ||
<%- if children = all_classes[index_klass.full_name] -%> | ||
<li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary> | ||
<%- traverse.call(children) -%> | ||
</ul></details> | ||
<%- elsif index_klass.display? -%> | ||
<li><% link.call(index_klass, true) %> | ||
<%- end -%> | ||
<%- end -%> | ||
<%- end -%> | ||
<%- traverse.call(top) -%> | ||
<%- end -%> | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters