mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
fix: Page container routing
This commit is contained in:
@@ -58,7 +58,6 @@ export default {
|
|||||||
get_current_page() {
|
get_current_page() {
|
||||||
const curr_route = frappe.get_route_str();
|
const curr_route = frappe.get_route_str();
|
||||||
let route = Object.keys(route_map).filter(route => route == curr_route)[0];
|
let route = Object.keys(route_map).filter(route => route == curr_route)[0];
|
||||||
|
|
||||||
if (!route) {
|
if (!route) {
|
||||||
// find route by matching it with dynamic part
|
// find route by matching it with dynamic part
|
||||||
const curr_route_parts = curr_route.split('/');
|
const curr_route_parts = curr_route.split('/');
|
||||||
@@ -70,7 +69,7 @@ export default {
|
|||||||
let weight = 0;
|
let weight = 0;
|
||||||
route_parts.forEach((part, i) => {
|
route_parts.forEach((part, i) => {
|
||||||
const curr_route_part = curr_route_parts[i];
|
const curr_route_part = curr_route_parts[i];
|
||||||
if (part === curr_route_part || curr_route_part.includes(':')) {
|
if (part === curr_route_part || part.includes(':')) {
|
||||||
weight += 1;
|
weight += 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -80,12 +79,13 @@ export default {
|
|||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
// get the route with the highest weight
|
// get the route with the highest weight
|
||||||
let weight = 0
|
|
||||||
for (let key in weighted_routes) {
|
for (let key in weighted_routes) {
|
||||||
const route_weight = weighted_routes[key];
|
const route_weight = weighted_routes[key];
|
||||||
if (route_weight > weight) {
|
if (route_weight === curr_route_parts.length) {
|
||||||
route = key;
|
route = key;
|
||||||
weight = route_weight;
|
break;
|
||||||
|
} else {
|
||||||
|
route = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user