Bug 38010: (QA follow-up) Stop breadcrumbs from keeping filters
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
c078585a8c
commit
36367bc316
|
|
@ -3,7 +3,7 @@
|
|||
<ol class="breadcrumb">
|
||||
<template v-for="(item, idx) in breadcrumbs" v-bind:key="idx">
|
||||
<NavigationItem
|
||||
v-if="idx < breadcrumbs.length - 1"
|
||||
v-if="idx < breadcrumbs.length - 1 || item.breadcrumbFormat"
|
||||
:item="item"
|
||||
:params="params"
|
||||
></NavigationItem>
|
||||
|
|
@ -31,6 +31,7 @@ export default {
|
|||
const navigationStore = inject("navigationStore");
|
||||
const { breadcrumbs } = storeToRefs(navigationStore);
|
||||
const { params } = navigationStore;
|
||||
|
||||
return {
|
||||
breadcrumbs,
|
||||
params,
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ router.beforeEach((to, from) => {
|
|||
if (to.path === "/cgi-bin/koha/acqui/vendors.pl") {
|
||||
router.push({ name: "VendorList" });
|
||||
}
|
||||
navigationStore.$patch({ current: to.matched, params: to.params || {} });
|
||||
navigationStore.$patch({
|
||||
current: to.matched,
|
||||
params: to.params || {},
|
||||
query: to.query || {},
|
||||
});
|
||||
removeMessages(); // This will actually flag the messages as displayed already
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,6 +7,13 @@ import VendorFormAdd from "../components/Vendors/VendorFormAdd.vue";
|
|||
|
||||
import { $__ } from "../i18n";
|
||||
|
||||
const vendorSearchBreadcrumb = ({ match, query }) => {
|
||||
if (!query || !query.supplier) return match.meta.self;
|
||||
match.meta.self.title = $__("Search for vendor: %s").format(query.supplier);
|
||||
match.meta.self.disabled = true;
|
||||
return match.meta.self;
|
||||
};
|
||||
|
||||
export const routes = [
|
||||
{
|
||||
path: "/cgi-bin/koha/acqui/acqui-home.pl",
|
||||
|
|
@ -25,6 +32,7 @@ export const routes = [
|
|||
title: $__("Vendors"),
|
||||
icon: "fa fa-shopping-cart",
|
||||
is_end_node: true,
|
||||
breadcrumbFormat: vendorSearchBreadcrumb,
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export const useNavigationStore = defineStore("navigation", () => {
|
|||
},
|
||||
current: null,
|
||||
params: {},
|
||||
query: {},
|
||||
});
|
||||
const actions = {
|
||||
setRoutes(routesDef) {
|
||||
|
|
@ -145,7 +146,17 @@ export const useNavigationStore = defineStore("navigation", () => {
|
|||
.map(match => {
|
||||
let path = _getPath(match, params);
|
||||
const externalPath = path.includes(".pl");
|
||||
const test = {
|
||||
let {
|
||||
meta: { self },
|
||||
} = match;
|
||||
if (self.breadcrumbFormat) {
|
||||
self = self.breadcrumbFormat({
|
||||
match: self,
|
||||
params: store.params,
|
||||
query: store.query,
|
||||
});
|
||||
}
|
||||
const breadcrumbInfo = {
|
||||
...match.meta.self,
|
||||
icon: null,
|
||||
...(externalPath
|
||||
|
|
@ -153,7 +164,7 @@ export const useNavigationStore = defineStore("navigation", () => {
|
|||
: { path }),
|
||||
children: null,
|
||||
};
|
||||
return test;
|
||||
return breadcrumbInfo;
|
||||
});
|
||||
return matches;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue