- Issue created by @TimeFor
baseUrl is duplicated when Drupal is installed in a subfolder. It wouldn't be so much an issue except there isn't really an easy way to get Views to spit out the path without the subfolder prefix already attached. So that subfolder is getting doubled up when the views-jump-menu.js is run.
Drupal is installed in: /us
My actual node content path is: /us/news
Views "link to content" field data: /us/news
html rendered in jump view:
<option data-url="/us/news">News</option>
JavaScript sets window url as: /us/us/news (problem)
Try out the module with Drupal installed in a subfolder.
I'm not sure what the best way to go about fixing this one. Maybe if full path URLs worked, that would fix this easily. But that's a separate issue that doesn't seem to be supported. Views in 9x+ doesn't seem to have a built in way to get the node's path without the baseURL subdirectory. Is there a way? Using Link to Content field spits out the subdirectory.
Line 13 of views-jump-menu.js has this code
const destination = settings.path.baseUrl + settings.path.pathPrefix + $(this).find(':selected').data('url').replace(/^\//, "");
I hacked up mine to look like this:
const destinationPath = $(this).find(':selected').data('url').replace(/^\//, "");
const destination = window.location.protocol + "//" + window.location.host + "/" + destinationPath;
This does blow out the settings.path.pathPrefix, which in my case isn't used. Im not sure what the usecase for that is. It could probably be saved here. And Im not sure I understand why settings.path.baseUrl was used over just window.location.host. But this hack fixed it for me until a better solution comes along.
Active
1.0
Code