Skip to content

Commit 6bb9300

Browse files
committed
Start with open when only one visible class/module
1 parent 4c7c46f commit 6bb9300

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@
1414
-%><code><%= index_klass.name %></code><%-
1515
end
1616
end
17-
-%>
18-
<%- traverse = proc do |klasses| -%>
17+
if top = all_classes[nil]
18+
solo = top.one? {|klass| klass.display?}
19+
traverse = proc do |klasses| -%>
1920
<ul class="link-list">
20-
<%- klasses.each do |index_klass| -%>
21-
<%- if children = all_classes[index_klass.full_name] -%>
22-
<li><details><summary><% link.call(index_klass) %></summary>
23-
<%- traverse.call(children) -%>
21+
<%- klasses.each do |index_klass| -%>
22+
<%- if children = all_classes[index_klass.full_name] -%>
23+
<li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary>
24+
<%- traverse.call(children) -%>
2425
</ul></details>
25-
<%- elsif index_klass.display? -%>
26+
<%- elsif index_klass.display? -%>
2627
<li><% link.call(index_klass, true) %>
28+
<%- end -%>
2729
<%- end -%>
2830
<%- end -%>
31+
<%- traverse.call(top) -%>
2932
<%- end -%>
30-
<%- traverse.call(all_classes[nil]) -%>
3133
</div>

0 commit comments

Comments
 (0)