Skip to content

Commit f51ea4d

Browse files
authored
ARROW-18391: [R] Fix the version selector dropdown in the dev docs (#14800)
For context, this overrides the default navbar HTML with a custom version which makes a single change - adding a span called "version" which the JS will override. An identically-named span existed in the template used with Bootstrap 3, which is why no JavaScript changes were needed. This approach is almost identical to that in this PR to the pkgdown package which implements the same thing: r-lib/pkgdown#2072 I built this locally, and it appears to have successfully added the dropdown back in. ![image](https://user-images.githubusercontent.com/13715823/205083695-e718c7e5-1dc1-4742-9ce8-f773611b8ab7.png) Authored-by: Nic Crane <[email protected]> Signed-off-by: Nic Crane <[email protected]>
1 parent 7f04d91 commit f51ea4d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

r/pkgdown/templates/navbar.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{{#navbar}}
2+
<nav class="navbar fixed-top navbar-{{{type}}} navbar-expand-lg bg-{{{bg}}}">
3+
<div class="container">
4+
{{#includes}}{{{before_title}}}{{/includes}}
5+
<a class="navbar-brand me-2" href="{{#site}}{{root}}{{/site}}index.html">{{#site}}{{title}}{{/site}}</a>
6+
7+
<span class = "version">
8+
<small class="nav-text {{#development}}text-{{version_label}}{{/development}} me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{#development}}{{version_tooltip}}{{/development}}">{{#package}}{{version}}{{/package}}</small>
9+
</span>
10+
11+
{{#includes}}{{{before_navbar}}}{{/includes}}
12+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="{{#translate}}{{toggle_nav}}{{/translate}}">
13+
<span class="navbar-toggler-icon"></span>
14+
</button>
15+
16+
<div id="navbar" class="collapse navbar-collapse ms-3">
17+
{{#left}}
18+
<ul class="navbar-nav me-auto">
19+
{{{.}}}
20+
</ul>
21+
{{/left}}
22+
23+
<form class="form-inline my-2 my-lg-0" role="search">
24+
<input type="search" class="form-control me-sm-2" aria-label="{{#translate}}{{toggle_nav}}{{/translate}}" name="search-input" data-search-index="{{#site}}{{root}}{{/site}}search.json" id="search-input" placeholder="{{#translate}}{{search_for}}{{/translate}}" autocomplete="off">
25+
</form>
26+
27+
{{#right}}
28+
<ul class="navbar-nav">
29+
{{{.}}}
30+
</ul>
31+
{{/right}}
32+
</div>
33+
34+
{{#includes}}{{{after_navbar}}}{{/includes}}
35+
</div>
36+
</nav>
37+
{{/navbar}}
38+

0 commit comments

Comments
 (0)