From b6c0c6c9d317a00e37526f1fd790e011bcca006c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 30 May 2022 17:44:49 +0200 Subject: [PATCH] Bug 32030: Improve breadcrumb (again) Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- .../vue/components/ERM/AgreementsFormAdd.vue | 2 +- .../prog/js/vue/components/ERM/Breadcrumb.vue | 16 +- .../ERM/EHoldingsPackagesFormAdd.vue | 2 +- .../intranet-tmpl/prog/js/vue/locales/en.json | 19 +- .../prog/js/vue/locales/fr-FR.json | 30 +- koha-tmpl/intranet-tmpl/prog/js/vue/routes.js | 599 ++++++++++-------- 6 files changed, 379 insertions(+), 289 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue index 7df6e2e620..a3f6bed97b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsFormAdd.vue @@ -2,7 +2,7 @@
{{ $t("Loading") }}

- {{ $t("Edit agreement.id", { id: agreement.agreement_id }) }} + {{ $t("Edit agreement .id", { id: agreement.agreement_id }) }}

{{ $t("New agreement") }}

diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Breadcrumb.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Breadcrumb.vue index f19e16a126..1801f4920b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Breadcrumb.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Breadcrumb.vue @@ -2,18 +2,30 @@ \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesFormAdd.vue index b3ed7f7965..c5d1fe7560 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsPackagesFormAdd.vue @@ -2,7 +2,7 @@
{{ $t("Loading") }}

- {{ $t("Edit package.id", { id: erm_package.package_id }) }} + {{ $t("Edit package .id", { id: erm_package.package_id }) }}

{{ $t("New package") }}

diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/locales/en.json b/koha-tmpl/intranet-tmpl/prog/js/vue/locales/en.json index 31e4219542..29a12db30e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/locales/en.json +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/locales/en.json @@ -1,12 +1,16 @@ { "/" : "/", "Access type" : "Access type", + "Add agreement" : "Add agreement", + "Add license" : "Add license", "Add new agreement" : "Add new agreement", "Add new document" : "Add new document", "Add new license" : "Add new license", "Add new period" : "Add new period", "Add new related agreement" : "Add new related agreement", "Add new user" : "Add new user", + "Add package" : "Add package", + "Add title" : "Add title", "Add to another package" : "Add to another package", "Agreement" : "Agreement", "Agreement " : { @@ -52,15 +56,19 @@ "Documents" : "Documents", "E-Resource management" : "E-Resource management", "Edit" : "Edit", - "Edit agreement" : { + "Edit agreement " : { "id" : "Edit agreement #%{id}" }, + "Edit agreemetn" : "Edit agreemetn", + "Edit license" : "Edit license", "Edit license " : { "id" : "Edit license #%{id}" }, - "Edit package" : { + "Edit package" : "Edit package", + "Edit package " : { "id" : "Edit package #%{id}" }, + "Edit title" : "Edit title", "Edit title " : { "id" : "Edit title #%{id}" }, @@ -75,6 +83,7 @@ "File type" : "File type", "First author" : "First author", "First editor" : "First editor", + "Home" : "Home", "Is perpetual" : "Is perpetual", "License" : "License", "License " : { @@ -137,6 +146,7 @@ "Remove this user" : "Remove this user", "Renewal priority" : "Renewal priority", "Required" : "Required", + "Resource" : "Resource", "Resource " : { "id" : "Resource #%{id}" }, @@ -145,7 +155,11 @@ "Role" : "Role", "Select a file" : "Select a file", "Select user" : "Select user", + "Show agreement" : "Show agreement", + "Show license" : "Show license", + "Show package" : "Show package", "Show resource" : "Show resource", + "Show title" : "Show title", "Start date" : "Start date", "Started on" : "Started on", "Status" : "Status", @@ -178,6 +192,7 @@ "Users" : "Users", "Vendor" : "Vendor", "Yes, delete" : "Yes, delete", + "eHoldings" : "eHoldings", "hello" : "hello", "language" : "language", "tos" : "tos" diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/locales/fr-FR.json b/koha-tmpl/intranet-tmpl/prog/js/vue/locales/fr-FR.json index 9cb62d5031..928d23f253 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/locales/fr-FR.json +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/locales/fr-FR.json @@ -134,9 +134,7 @@ "E-Resource management": "", "Agreements": "", "eHoldings": "", - "Edit license": { - "id": "" - }, + "Edit license": "", "New license": "", "License name": "", "Type": "", @@ -152,9 +150,7 @@ "Remove this agreement": "", "Add new agreement": "", "There are no agreements created yet": "", - "Edit package": { - "id": "" - }, + "Edit package": "", "New package": "", "Package name": "", "Type: ": "", @@ -174,9 +170,7 @@ "hello": "", "/": "", "New eHoldings package": "", - "Edit title": { - "id": "" - }, + "Edit title": "", "New title": "", "Title updated": "", "Title created": "", @@ -242,5 +236,21 @@ "resource identifier": "", "Package content type": "", "Coverage dates": "", - "Resource identifier": "" + "Resource identifier": "", + "Home": "", + "Show agreement": "", + "Add agreement": "", + "Edit agreemetn": "", + "Add package": "", + "Show title": "", + "Add title": "", + "Resource": "", + "Show license": "", + "Add license": "", + "Edit agreement ": { + "id": "" + }, + "Edit package ": { + "id": "" + } } \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/routes.js b/koha-tmpl/intranet-tmpl/prog/js/vue/routes.js index 50a3bbaf6e..ed28a06f08 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes.js @@ -1,3 +1,5 @@ +import { h } from "vue"; +import { RouterView } from "vue-router"; import ERMHome from "./components/ERM/ERMHome.vue"; import AgreementsList from "./components/ERM/AgreementsList.vue"; import AgreementsShow from "./components/ERM/AgreementsShow.vue"; @@ -19,303 +21,354 @@ import LicensesFormAdd from "./components/ERM/LicensesFormAdd.vue"; import LicensesFormConfirmDelete from "./components/ERM/LicensesFormConfirmDelete.vue"; const breadcrumbs = { - home: { text: "Home", path: "/cgi-bin/koha/mainpage.pl" }, + home: { + text: "Home", // $t("Home") + path: "/cgi-bin/koha/mainpage.pl", + }, erm_home: { - text: "E-Resource management", + text: "E-Resource management", // $t("E-Resource management") path: "/cgi-bin/koha/erm/erm.pl", }, - agreements: { text: "Agreements", path: "/cgi-bin/koha/erm/agreements" }, + agreements: { + text: "Agreements", // $t("Agreements") + path: "/cgi-bin/koha/erm/agreements", + }, eholdings: { - home: { text: "eHoldings", path: "/cgi-bin/koha/erm/eholdings" }, - titles: { text: "Titles", path: "/cgi-bin/koha/erm/eholdings/titles" }, + home: { + text: "eHoldings", // $t("eHoldings") + path: "/cgi-bin/koha/erm/eholdings", + }, + titles: { + text: "Titles", // $t("Titles") + path: "/cgi-bin/koha/erm/eholdings/titles", + }, packages: { - text: "Packages", + text: "Packages", // $t("Packages") path: "/cgi-bin/koha/erm/eholdings/packages", }, }, - licenses: { text: "Licenses", path: "/cgi-bin/koha/erm/licenses" }, + licenses: { + text: "Licenses", // $t("Licenses") + path: "/cgi-bin/koha/erm/licenses", + }, +}; +const breadcrumb_paths = { + agreements: [ + breadcrumbs.home, + breadcrumbs.erm_home, + breadcrumbs.agreements, + ], + eholdings: [ + breadcrumbs.home, + breadcrumbs.erm_home, + breadcrumbs.eholdings.home, + ], + licenses: [breadcrumbs.home, breadcrumbs.erm_home, breadcrumbs.licenses], }; +function build_breadcrumb(parent_breadcrumb, current) { + let breadcrumb = parent_breadcrumb.flat(Infinity); + if (current) { + breadcrumb.push({ + text: current, + }); + } + return breadcrumb; +} + export const routes = [ { path: "/cgi-bin/koha/mainpage.pl" }, { path: "/cgi-bin/koha/erm/erm.pl", component: ERMHome, meta: { - breadcrumb: [breadcrumbs.home, breadcrumbs.erm_home], + breadcrumb: () => [breadcrumbs.home, breadcrumbs.erm_home], }, }, { path: "/cgi-bin/koha/erm/agreements", - component: AgreementsList, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.agreements, - ], - view: "list", - }, - }, - { - path: "/cgi-bin/koha/erm/agreements/:agreement_id", - component: AgreementsShow, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.agreements, - ], - view: "show", - }, - }, - { - path: "/cgi-bin/koha/erm/agreements/delete/:agreement_id", - component: AgreementsFormConfirmDelete, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.agreements, - ], - view: "confirm-delete", - }, - }, - { - path: "/cgi-bin/koha/erm/agreements/add", - component: AgreementsFormAdd, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.agreements, - ], - view: "add", - }, - }, - { - path: "/cgi-bin/koha/erm/agreements/edit/:agreement_id", - component: AgreementsFormAdd, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.agreements, - ], - view: "edit", - }, + component: { render: () => h(RouterView) }, + children: [ + { + path: "", + component: AgreementsList, + meta: { + breadcrumb: () => breadcrumb_paths.agreements, + }, + }, + { + path: ":agreement_id", + component: AgreementsShow, + meta: { + breadcrumb: () => + build_breadcrumb( + breadcrumb_paths.agreements, + "Show agreement" // $t("Show agreement") + ), + }, + }, + { + path: "delete/:agreement_id", + component: AgreementsFormConfirmDelete, + meta: { + breadcrumb: () => + build_breadcrumb( + breadcrumb_paths.agreements, + "Delete agreement" // $t("Delete agreement") + ), + }, + }, + { + path: "add", + component: AgreementsFormAdd, + meta: { + breadcrumb: () => + build_breadcrumb( + breadcrumb_paths.agreements, + "Add agreement" // $t("Add agreement") + ), + }, + }, + { + path: "edit/:agreement_id", + component: AgreementsFormAdd, + meta: { + breadcrumb: () => + build_breadcrumb( + breadcrumb_paths.agreements, + "Edit agreement" // $t("Edit agreemetn") + ), + }, + }, + ], }, { path: "/cgi-bin/koha/erm/eholdings", - component: EHoldingsMain, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - ], - view: "list", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/packages", - component: EHoldingsPackagesList, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.packages, - ], - view: "list", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/packages/:package_id", - component: EHoldingsPackagesShow, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.packages, - ], - view: "show", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/packages/delete/:package_id", - component: EHoldingsPackagesFormConfirmDelete, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.packages, - ], - view: "confirm-delete-form", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/packages/add", - component: EHoldingsPackagesFormAdd, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.packages, - ], - view: "add", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/packages/edit/:package_id", - component: EHoldingsPackagesFormAdd, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.packages, - ], - view: "edit", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/titles", - component: EHoldingsTitlesList, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.titles, - ], - view: "list", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/titles/:title_id", - component: EHoldingsTitlesShow, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.titles, - ], - view: "show", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/titles/delete/:title_id", - component: EHoldingsTitlesFormConfirmDelete, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.titles, - ], - view: "confirm-delete-form", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/titles/add", - component: EHoldingsTitlesFormAdd, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.titles, - ], - view: "add", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/titles/edit/:title_id", - component: EHoldingsTitlesFormAdd, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - breadcrumbs.eholdings.titles, - ], - view: "edit", - }, - }, - { - path: "/cgi-bin/koha/erm/eholdings/resources/:resource_id", - component: EHoldingsResourcesShow, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.eholdings.home, - ], - view: "show", - }, + component: { render: () => h(RouterView) }, + children: [ + { + path: "", + component: EHoldingsMain, + meta: { + breadcrumb: () => breadcrumb_paths.eholdings, + }, + }, + { + path: "packages", + component: { render: () => h(RouterView) }, + children: [ + { + path: "", + component: EHoldingsPackagesList, + meta: { + breadcrumb: () => + build_breadcrumb([ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.packages, + ]), + }, + }, + { + path: ":package_id", + component: EHoldingsPackagesShow, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.packages, + ], + "Show package" // $t("Show package") + ), + }, + }, + { + path: "delete/:package_id", + component: EHoldingsPackagesFormConfirmDelete, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.packages, + ], + "Delete package" // $t("Delete package") + ), + }, + }, + { + path: "add", + component: EHoldingsPackagesFormAdd, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.packages, + ], + "Add package" // $t("Add package") + ), + }, + }, + { + path: "edit/:package_id", + component: EHoldingsPackagesFormAdd, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.packages, + ], + "Edit package" // $t("Edit package") + ), + }, + }, + ], + }, + { + path: "titles", + component: { render: () => h(RouterView) }, + children: [ + { + path: "", + component: EHoldingsTitlesList, + meta: { + breadcrumb: () => + build_breadcrumb([ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.titles, + ]), + }, + }, + { + path: ":title_id", + component: EHoldingsTitlesShow, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.titles, + ], + "Show title" // $t("Show title") + ), + }, + }, + { + path: "delete/:title_id", + component: EHoldingsTitlesFormConfirmDelete, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.titles, + ], + "Delete title" // $t("Delete title") + ), + }, + }, + { + path: "add", + component: EHoldingsTitlesFormAdd, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.titles, + ], + "Add title" // $t("Add title") + ), + }, + }, + { + path: "edit/:title_id", + component: EHoldingsTitlesFormAdd, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.titles, + ], + "Edit title" // $t("Edit title") + ), + }, + }, + ], + }, + { + path: "resources/:resource_id", + component: EHoldingsResourcesShow, + meta: { + breadcrumb: () => + build_breadcrumb( + [ + breadcrumb_paths.eholdings, + breadcrumbs.eholdings.titles, + ], + "Resource" // $t("Resource") + ), + }, + }, + ], }, { path: "/cgi-bin/koha/erm/licenses", - component: LicensesList, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.licenses, - ], - view: "list", - }, - }, - { - path: "/cgi-bin/koha/erm/licenses/:license_id", - component: LicensesShow, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.licenses, - ], - view: "show", - }, - }, - { - path: "/cgi-bin/koha/erm/licenses/delete/:license_id", - component: LicensesFormConfirmDelete, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.licenses, - ], - view: "confirm-delete-form", - }, - }, - { - path: "/cgi-bin/koha/erm/licenses/add", - component: LicensesFormAdd, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.licenses, - ], - view: "add", - }, - }, - { - path: "/cgi-bin/koha/erm/licenses/edit/:license_id", - component: LicensesFormAdd, - meta: { - breadcrumb: [ - breadcrumbs.home, - breadcrumbs.erm_home, - breadcrumbs.licenses, - ], - view: "edit", - }, + component: { render: () => h(RouterView) }, + children: [ + { + path: "", + component: LicensesList, + meta: { + breadcrumb: () => breadcrumb_paths.licenses, + }, + }, + { + path: ":license_id", + component: LicensesShow, + meta: { + breadcrumb: () => + build_breadcrumb( + breadcrumb_paths.licenses, + "Show license" // $t("Show license") + ), + }, + }, + { + path: "delete/:license_id", + component: LicensesFormConfirmDelete, + meta: { + breadcrumb: () => + build_breadcrumb( + breadcrumb_paths.licenses, + "Delete license" // $t("Delete license") + ), + }, + }, + { + path: "add", + component: LicensesFormAdd, + meta: { + breadcrumb: () => + build_breadcrumb( + breadcrumb_paths.licenses, + "Add license" // $t("Add license") + ), + }, + }, + { + path: "edit/:license_id", + component: LicensesFormAdd, + meta: { + breadcrumb: () => + build_breadcrumb( + breadcrumb_paths.licenses, + "Edit license" // $t("Edit license") + ), + }, + }, + ], }, ]; -- 2.39.2