Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions js/main-menu-dropdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
window.mainMenuDropdown = {
bind: function() {
$("[data-toggle='ecosystem-dropdown']").on("click", function() {
toggleDropdown($(this).attr("data-toggle"));
});

$("[data-toggle='resources-dropdown']").on("click", function() {
toggleDropdown($(this).attr("data-toggle"));
});

function toggleDropdown(menuToggle) {
var showMenuClass = "show-menu";
var menuClass = "." + menuToggle + "-menu";

if ($(menuClass).hasClass(showMenuClass)) {
$(menuClass).removeClass(showMenuClass);
} else {
$("[data-toggle=" + menuToggle + "].show-menu").removeClass(
showMenuClass
);
$(menuClass).addClass(showMenuClass);
}
}
}
};
49 changes: 43 additions & 6 deletions pytorch_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,25 @@
</li>

<li>
<a href="{{ theme_variables.external_urls['features'] }}">Features</a>
<div class="ecosystem-dropdown">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section seems to be causing the render issues cause dropdown wasn't allowed before

<a id="dropdownMenuButton" data-toggle="ecosystem-dropdown">
Ecosystem
</a>
<div class="ecosystem-dropdown-menu">
<a class="nav-dropdown-item" href="{{ theme_variables.external_urls['hub'] }}"">
<span class=dropdown-title>Models (Beta)</span>
<p>Discover, publish, and reuse pre-trained models</p>
</a>
<a class="nav-dropdown-item" href="{{ theme_variables.external_urls['ecosystem'] }}">
<span class=dropdown-title>Tools & Libraries</span>
<p>Explore the ecosystem of tools and libraries</p>
</a>
</div>
</div>
</li>

<li>
<a href="{{ theme_variables.external_urls['ecosystem'] }}">Ecosystem</a>
<a href="{{ theme_variables.external_urls['mobile'] }}">Mobile</a>
</li>

<li>
Expand All @@ -114,7 +128,21 @@
</li>

<li>
<a href="{{ theme_variables.external_urls['resources'] }}">Resources</a>
<div class="resources-dropdown">
<a id="resourcesDropdownButton" data-toggle="resources-dropdown">
Resources
</a>
<div class="resources-dropdown-menu">
<a class="nav-dropdown-item" href="{{ theme_variables.external_urls['resources'] }}"">
<span class=dropdown-title>Developer Resources</span>
<p>Find resources and get questions answered</p>
</a>
<a class="nav-dropdown-item" href="{{ theme_variables.external_urls['features'] }}">
<span class=dropdown-title>About</span>
<p>Learn about PyTorch’s features and capabilities</p>
</a>
</div>
</div>
Comment on lines +131 to +145
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section seems to be causing the render issues cause dropdown wasn't allowed before

</li>

<li>
Expand Down Expand Up @@ -418,15 +446,23 @@ <h2>Resources</h2>
<div class="main-menu">
<ul>
<li>
<a href="#">Get Started</a>
<a href="{{ theme_variables.external_urls['get_started'] }}">Get Started</a>
</li>

<li>
<a href="{{ theme_variables.external_urls['features'] }}">Features</a>
</li>

<li>
<a href="{{ theme_variables.external_urls['ecosystem'] }}">Ecosystem</a>
</li>

<li>
<a href="#">Features</a>
<a href="{{ theme_variables.external_urls['mobile'] }}">Mobile</a>
</li>

<li>
<a href="#">Ecosystem</a>
<a href="{{ theme_variables.external_urls['hub'] }}">PyTorch Hub</a>
</li>

<li>
Expand Down Expand Up @@ -465,6 +501,7 @@ <h2>Resources</h2>
sideMenus.bind();
scrollToAnchor.bind();
highlightNavigation.bind();
mainMenuDropdown.bind();

// Add class to links that have code blocks, since we cannot create links in code blocks
$("article.pytorch-article a span.pre").each(function(e) {
Expand Down
11,992 changes: 11,991 additions & 1 deletion pytorch_sphinx_theme/static/css/theme.css

Large diffs are not rendered by default.

Loading