mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Fix TabsAndPanelsController now that #! are removed from url
This PR https://github.com/openfoodfoundation/openfoodnetwork/pull/9729 remove #! from url. But unfortunately, AngularJs rewrite "example.com#panel" as "example.com#/panel" thus breaking the original implementation.
This commit is contained in:
@@ -15,9 +15,15 @@ export default class extends Controller {
|
||||
|
||||
// Display panel specified in url anchor
|
||||
const anchors = window.location.toString().split("#");
|
||||
const anchor = anchors.length > 1 ? anchors.pop() : "";
|
||||
let anchor = anchors.length > 1 ? anchors.pop() : "";
|
||||
|
||||
if (anchor != "") {
|
||||
// Conveniently AngularJs rewrite "example.com#panel" to "example.com#/panel" :(
|
||||
// strip the starting / if any
|
||||
if (anchor[0] == "/") {
|
||||
anchor = anchor.slice(1);
|
||||
}
|
||||
|
||||
this.updateActivePanel(anchor);
|
||||
|
||||
// tab
|
||||
|
||||
Reference in New Issue
Block a user