Bugzilla – Attachment 154263 Details for
Bug 34417
ERM's breadcrumb (Vue) does not display the entity's name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34417: [ALTERNATIVE PATCH] Set entity's name from the component itself
Bug-34417-ALTERNATIVE-PATCH-Set-entitys-name-from-.patch (text/plain), 5.52 KB, created by
Jonathan Druart
on 2023-08-04 13:07:42 UTC
(
hide
)
Description:
Bug 34417: [ALTERNATIVE PATCH] Set entity's name from the component itself
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-08-04 13:07:42 UTC
Size:
5.52 KB
patch
obsolete
>From fe9c1b72eeb89369d2a46a9248f351e14f951fe8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 4 Aug 2023 15:05:38 +0200 >Subject: [PATCH] Bug 34417: [ALTERNATIVE PATCH] Set entity's name from the > component itself > >I would have preferred to not modify the component to pass what we have >fetched, but I think it's cleaner than hacking the low level fetch >function. > >This is just a POC and work only on the "show agreement" view >--- > .../prog/js/vue/components/Breadcrumbs.vue | 5 +++++ > .../js/vue/components/ERM/AgreementsShow.vue | 1 + > .../prog/js/vue/components/ERM/Main.vue | 10 +++++++-- > .../prog/js/vue/components/NavigationItem.vue | 21 +++++++++++++++++++ > .../intranet-tmpl/prog/js/vue/routes/erm.js | 2 +- > 5 files changed, 36 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Breadcrumbs.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Breadcrumbs.vue >index 9d2b74db0c4..bfad7fc95d7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Breadcrumbs.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Breadcrumbs.vue >@@ -6,6 +6,7 @@ > v-if="idx < breadcrumbs.length - 1" > :item="item" > :params="params" >+ :args="args" > ></NavigationItem> > <NavigationItem > v-else >@@ -16,6 +17,7 @@ > href: undefined, > }" > :params="params" >+ :args="args" > ></NavigationItem> > </template> > </ol> >@@ -40,6 +42,9 @@ export default { > components: { > NavigationItem, > }, >+ props: { >+ args: Object, >+ }, > } > </script> > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue >index 34e77e98b8d..cd227c5913b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsShow.vue >@@ -387,6 +387,7 @@ export default { > client.agreements.get(agreement_id).then( > agreement => { > this.agreement = agreement >+ this.$root.set_breadcrumb({ agreement: this.agreement }) > this.initialized = true > }, > error => {} >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >index 12e569e28d6..6b097eaad56 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >@@ -1,7 +1,7 @@ > <template> > <div v-if="initialized && config.settings.ERMModule == 1"> > <div id="sub-header"> >- <Breadcrumbs /> >+ <Breadcrumbs :args="breadcrumb_args" /> > <Help /> > </div> > <div class="main container-fluid"> >@@ -28,7 +28,7 @@ > </template> > > <script> >-import { inject } from "vue" >+import { inject, ref } from "vue" > import Breadcrumbs from "../Breadcrumbs.vue" > import Help from "../Help.vue" > import LeftMenu from "../LeftMenu.vue" >@@ -51,6 +51,8 @@ export default { > > const { config } = storeToRefs(ERMStore) > >+ const breadcrumb_args = ref() >+ > return { > vendorStore, > AVStore, >@@ -59,6 +61,7 @@ export default { > setError, > loading, > loaded, >+ breadcrumb_args, > } > }, > data() { >@@ -164,6 +167,9 @@ export default { > ) > return navigationTree > }, >+ set_breadcrumb(args) { >+ this.breadcrumb_args = args >+ }, > }, > components: { > Breadcrumbs, >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/NavigationItem.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/NavigationItem.vue >index baa20e5e643..f568966d212 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/NavigationItem.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/NavigationItem.vue >@@ -55,6 +55,27 @@ export default { > props: { > item: Object, > params: Object, >+ args: Object, >+ }, >+ watch: { >+ args(newArgs, oldArgs) { >+ this.adjust_titles(newArgs) >+ }, >+ }, >+ methods: { >+ adjust_titles(args) { >+ var re = /(?:{([^}]+)})/g >+ let m >+ let title = this.item.title >+ while ((m = re.exec(title))) { >+ const s = m[1].split("\.") >+ title = title.replace( >+ "{%s.%s}".format(s[0], s[1]), >+ this.args[s[0]][s[1]] >+ ) >+ } >+ this.item.title = title >+ }, > }, > } > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js >index 39eea67c417..c388904a712 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js >@@ -60,7 +60,7 @@ export const routes = [ > path: ":agreement_id", > name: "AgreementsShow", > component: markRaw(AgreementsShow), >- title: $__("Show agreement"), >+ title: $__("Show {agreement.name}"), > children: [ > { > path: "items", >-- >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 34417
:
153914
|
153958
|
153959
|
153960
|
154258
| 154263