Skip to content
Open
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
58 changes: 56 additions & 2 deletions docs/input/_Navbar.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,65 @@
{
Tuple.Create("Documentation", Context.GetLink("docs")),
Tuple.Create("API", Context.GetLink("api")),
Tuple.Create("<i></i> 5.12.0", "/5.12.0/docs"),
};

// Define a list of versions with their respective links and status (e.g., latest, EOL).
var VersionList = new List<(string Name, string Link, string Status, bool IsReleased)>
{
("5.12", "/5.12.0/docs", "(EOL)", true),
("6.0", "/6.0.0/docs", "", true),
("6.1-6.3", "/", "(latest)", true),
("main branch", "/dev/docs", "(unstable)", false),
};

// determine currently viewed version
var CurrentlyViewedVersion = VersionList.Last().Name;
@foreach (var version in VersionList)
{
if (Context.GetLink(Document).StartsWith(version.Link))
{
CurrentlyViewedVersion = version.Name;
break;
}
}

foreach(Tuple<string, string> p in pages)
{
string active = Context.GetLink(Document).StartsWith(p.Item2) ? "active" : null;
<li class="@active"><a href="@p.Item2">@Html.Raw(p.Item1)</a></li>
}
}

<li class="dropdown">

Check warning on line 34 in docs/input/_Navbar.cshtml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Surround this <li> item tag by a <ul> or <ol> container one.

See more on https://sonarcloud.io/project/issues?id=GitTools_GitVersion&issues=AZsUVYb9iGPAHl6irZld&open=AZsUVYb9iGPAHl6irZld&pullRequest=4782
<a href="javascript:void(0)" class="dropbtn">
Other Versions - v: @Html.Raw(@CurrentlyViewedVersion)
<span class="fa fa-caret-down"></span>
</a>
<div class="dropdown-content">
<dl>
<dt>Releases</dt>
@foreach (var version in VersionList)
{
if (version.IsReleased)
{
<dd>
<a href="@version.Link">@version.Name @version.Status</a>
</dd>
}
}
</dl>
<dl>
<dt>In Development</dt>
@foreach (var version in VersionList)
{
if (!version.IsReleased)
{
<dd>
<a href="@version.Link">@version.Name @version.Status</a>
</dd>
}
}
</dl>

</div>
</li>
}
41 changes: 41 additions & 0 deletions docs/input/assets/css/override.less
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,44 @@ main .col-sm-6 {
flex-direction: column;
}
}

.dropdown {
display: inline-block;
left: 550px;
}

/* Dropdown Button */
.dropbtn {
padding: 16px;
border: none;
cursor: pointer;
}

/* Dropdown content (hidden by default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 150px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}

/* Links inside dropdown content */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {
background-color: #f1f1f1
}

/* Show the dropdown content on hover */
.dropdown:hover .dropdown-content {
display: block;
padding: 12px 16px;
}