Bugzilla – Attachment 153937 Details for
Bug 34425
Fix breadcrumbs vue component
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34425: fix Breadcrumbs vue component
Bug-34425-fix-Breadcrumbs-vue-component.patch (text/plain), 3.62 KB, created by
Agustín Moyano
on 2023-07-26 20:28:15 UTC
(
hide
)
Description:
Bug 34425: fix Breadcrumbs vue component
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2023-07-26 20:28:15 UTC
Size:
3.62 KB
patch
obsolete
>From ca69c452b05a27a5921b16a8335f0f33e47908b3 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Wed, 26 Jul 2023 17:02:36 -0300 >Subject: [PATCH] Bug 34425: fix Breadcrumbs vue component > >This patch fixes Breadcrumbs component when there is no title in a node in the routes tree, >and fixes the links when there are parameters and the node has no name defined >--- > .../prog/js/vue/stores/navigation.js | 52 +++++++++++++++---- > 1 file changed, 41 insertions(+), 11 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/navigation.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/navigation.js >index b252923f10..8dcaee6d84 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/navigation.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/navigation.js >@@ -72,7 +72,11 @@ export const useNavigationStore = defineStore("navigation", { > getters: { > breadcrumbs() { > if (this.current) >- return _buildFromCurrentMatches(this.current, this.routeState); >+ return _buildFromCurrentMatches( >+ this.current, >+ this.routeState, >+ this.params >+ ); > > return _getBaseElements(this.routeState); > >@@ -100,14 +104,18 @@ export const useNavigationStore = defineStore("navigation", { > ); > } > >- function _buildFromCurrentMatches(currentMatches, routeState) { >+ function _buildFromCurrentMatches( >+ currentMatches, >+ routeState, >+ params >+ ) { > return [ > { > ...routeState, > icon: null, > children: null, > }, >- ..._mapMatches(currentMatches), >+ ..._mapMatches(currentMatches, params), > ]; > } > >@@ -115,15 +123,37 @@ export const useNavigationStore = defineStore("navigation", { > return child.is_base || (child.path && child.path !== ""); > } > >- function _mapMatches(currentMatches) { >+ function _hasTitle(child) { >+ return !!child.title; >+ } >+ >+ function _getPath(match, params) { >+ if (match.path && params) { >+ return match.path.replaceAll( >+ /(:(\w+))/g, >+ (text, first_match, second_match) => { >+ return params[second_match]; >+ } >+ ); >+ } >+ } >+ >+ function _mapMatches(currentMatches, params) { > return currentMatches >- .filter(match => _isBaseOrNotStub(match.meta.self)) >- .map(match => ({ >- ...match.meta.self, >- icon: null, >- path: match.path, >- children: null, >- })); >+ .filter( >+ match => >+ _isBaseOrNotStub(match.meta.self) && >+ _hasTitle(match.meta.self) >+ ) >+ .map(match => { >+ let path = _getPath(match, params); >+ return { >+ ...match.meta.self, >+ icon: null, >+ path, >+ children: null, >+ }; >+ }); > } > }, > leftNavigation() { >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34425
: 153937 |
153938