File tree 1 file changed +6
-1
lines changed
internal/app/ui/templates/partials/cookbook
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ <h1 class="cookbook-headline">
5
5
</ h1 >
6
6
</ div >
7
7
< div class ="col-auto ">
8
- < select class ="form-select form-select-sm " id ="cookbook-versions-dropdown " onchange ="if (this.value) window.location.href=window.location.pathname.replace('{{.cookbook.Metadata.Version}}', this.value) ">
8
+ < select class ="form-select form-select-sm " id ="cookbook-versions-dropdown " onchange ="if (this.value) changeUrl( this.value) ">
9
9
< option selected value ="{{ .cookbook.Metadata.Version }} "> {{ .cookbook.Metadata.Version }}</ option >
10
10
</ select >
11
11
</ div >
@@ -35,6 +35,11 @@ <h1 class="cookbook-headline">
35
35
selectBox . removeChild ( selectBox . firstElementChild )
36
36
}
37
37
) ;
38
+
39
+ function changeUrl ( v ) {
40
+ const searchTerm = window . location . pathname . includes ( "/_latest/" ) ? "/_latest/" : '/{{.cookbook.Metadata.Version}}/'
41
+ window . location . href = window . location . pathname . replace ( searchTerm , '/' + v + '/' ) ;
42
+ }
38
43
</ script >
39
44
< div class ="col ">
40
45
< ul class ="nav nav-tabs justify-content-end ">
You can’t perform that action at this time.
0 commit comments