Skip to content

Commit

Permalink
ENH attempt to reload current page in newly-selected version
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewandante committed Oct 10, 2023
1 parent 2ca5517 commit 66a16da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Resources/themes/default/doctum.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ var Doctum = {
{# Enable the version switcher #}
var versionSwitcher = document.getElementById('version-switcher');
if (versionSwitcher !== null) {
versionSwitcher.addEventListener('change', function () {
window.location = this.value;
var currentVersion = versionSwitcher.options[versionSwitcher.selectedIndex].dataset.version;
versionSwitcher.addEventListener('change', function (event) {
var targetVersion = event.target.options[event.target.selectedIndex].dataset.version;
window.location = window.location.pathname.replace(currentVersion, targetVersion);
});
}
{% endif %}
Expand Down

0 comments on commit 66a16da

Please sign in to comment.