forked from rails/sdoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The current navigation tree suffers from several problems: * From a UX perspective, when a navigation tree has many levels, interacting with the tree becomes tedious. Likewise, when a tree is very long, scanning becomes more difficult and it is easy to lose track of where you are in the hierarchy. For projects like Rails, the navigation tree has many levels and is very long. * The navigation tree uses JavaScript to navigate to pages instead of actual links. From a UX perspective, this can be frustrating when the user expects the entries to behave like links, such as when right-clicking or Ctrl+clicking. From an SEO perspective, it can be harmful because search engines cannot crawl the entries. * The CSS for the navigation tree is very brittle. The tree uses a repeating background image to achieve its striping effect, and requires entries to be a specific height to align with the background. This makes it difficult to change anything related to size, such as font size or even font family. * In terms of page rendering costs, the navigation tree can be very heavy for large projects. For Rails, the navigation tree adds several thousand nodes to the DOM. Furthermore, the tree is rendered entirely via JavaScript -- no static HTML -- which compounds the cost. This commit replaces the navigation tree with a static sidebar per page. For the main page, the sidebar will display a list of top-level modules and a heading-based outline for the main page content. For other prose files (such as `README` files), the sidebar will similarly display a heading-based outline. For modules, the sidebar will display a list of their methods, as well as a heading-based outline if the module has a top-level comment that includes headings. The `filter.svg` file is from [Feather icons][feather] v4.29.0, and is [licensed under the MIT license][license]. [feather]: https://feathericons.com/ [license]: https://github.com/feathericons/feather/blob/v4.29.0/LICENSE
- Loading branch information
1 parent
8e3384e
commit d0e2ead
Showing
24 changed files
with
375 additions
and
724 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<% if @context.text? %> | ||
<div class="nav__outline"> | ||
<%= outline(@context) %> | ||
</div> | ||
<% else %> | ||
<ul class="nav__list"> | ||
<% @context.each_classmodule do |rdoc_module| %> | ||
<li><%= button_to_search rdoc_module %></li> | ||
<% end %> | ||
</ul> | ||
<% end %> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="nav__outline"> | ||
<%= outline(@context) %> | ||
</div> | ||
|
||
<div class="nav__heading">Modules</div> | ||
<ul class="nav__list"> | ||
<% top_modules(@context.store).each do |rdoc_module| %> | ||
<li><%= link_to rdoc_module %></li> | ||
<% end %> | ||
</ul> |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<%= button_to_search @context, display_name: short_name(@context) %> | ||
|
||
<% if outline = outline(@context) %> | ||
<div class="nav__outline"> | ||
<%= outline %> | ||
</div> | ||
<% end %> | ||
|
||
<% unless (methods = module_methods(@context)).empty? %> | ||
<div class="nav__heading">Methods</div> | ||
<ul class="nav__list"> | ||
<% methods.each do |rdoc_method| %> | ||
<li><%= link_to short_name(rdoc_method), rdoc_method, | ||
class: "nav__method-link#{"--singleton" if rdoc_method.singleton}" %></li> | ||
<% end %> | ||
</ul> | ||
<% end %> |
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
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
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
Oops, something went wrong.