From 9acd9ed3c824fb7f1b52b7d33b32339f1469e062 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 6 Jul 2023 11:27:50 +0200 Subject: [PATCH] Bug 30708: Rebase - Use name instead of url for router-links Adjust code to match changes done by bug 32932. Signed-off-by: Laurence Rault Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../js/vue/components/Preservation/Main.vue | 12 +++------ .../vue/components/Preservation/Settings.vue | 2 +- .../Preservation/SettingsProcessings.vue | 12 ++++++--- .../SettingsProcessingsFormAdd.vue | 6 ++--- .../Preservation/SettingsProcessingsShow.vue | 11 ++++---- .../components/Preservation/TrainsFormAdd.vue | 6 ++--- .../Preservation/TrainsFormAddItem.vue | 23 +++++++++-------- .../Preservation/TrainsFormAddItems.vue | 11 ++++---- .../components/Preservation/TrainsList.vue | 25 ++++++++++--------- .../components/Preservation/TrainsShow.vue | 23 ++++++++++------- .../components/Preservation/WaitingList.vue | 13 +++++----- .../prog/js/vue/routes/preservation.js | 13 ++++++++++ 12 files changed, 91 insertions(+), 66 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue index 07794196f2..214fc20a7b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue @@ -17,16 +17,14 @@
{{ $__("Preservation") }}
  • - + {{ $__("Home") }}
  • {{ $__("Trains") }}
  • {{ $__("Waiting list") }}
  • - + {{ $__("Settings") }} diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue index a093bef9fa..29d8f1a419 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Settings.vue @@ -59,7 +59,7 @@
    {{ $__("Cancel") }} {{ processing.name }} @@ -21,7 +24,10 @@ > {{ $__("Edit this processing") }} @@ -29,7 +35,7 @@
  • diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue index 7ca15585e1..6504cb6a0b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsFormAdd.vue @@ -168,7 +168,7 @@
    {{ $__("Cancel") }} { this.setMessage(this.$__("Processing updated")) - this.$router.push("/cgi-bin/koha/preservation/settings") + this.$router.push({ name: "Settings" }) }, error => {} ) @@ -284,7 +284,7 @@ export default { client.processings.create(processing).then( success => { this.setMessage(this.$__("Processing created")) - this.$router.push("/cgi-bin/koha/preservation/settings") + this.$router.push({ name: "Settings" }) }, error => {} ) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsShow.vue index 25a34781f3..72e9f9d07e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsShow.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/SettingsProcessingsShow.vue @@ -5,7 +5,10 @@ {{ $__("Processing #%s").format(processing.processing_id) }} @@ -55,7 +58,7 @@
    {{ $__("Close") }} {} ) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAdd.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAdd.vue index 2e1195426f..c1ac05aa3e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAdd.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAdd.vue @@ -79,7 +79,7 @@
    {{ $__("Cancel") }} { this.setMessage(this.$__("Train updated")) - this.$router.push("/cgi-bin/koha/preservation/trains") + this.$router.push({ name: "TrainsList" }) }, error => {} ) @@ -184,7 +184,7 @@ export default { client.trains.create(train).then( success => { this.setMessage(this.$__("Train created")) - this.$router.push("/cgi-bin/koha/preservation/trains") + this.$router.push({ name: "TrainsList" }) }, error => {} ) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItem.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItem.vue index e59e531a4d..01108bb46f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItem.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItem.vue @@ -96,7 +96,7 @@
    {{ $__("Cancel") }} {{ $__("Cancel") }} { this.setMessage(this.$__("Item updated")) - this.$router.push( - "/cgi-bin/koha/preservation/trains/" + - this.train.train_id - ) + this.$router.push({ + name: "TrainsShow", + params: { train_id: this.train.train_id }, + }) }, error => {} ) @@ -362,10 +365,10 @@ export default { client.train_items.create(train_item, this.train.train_id).then( success => { this.setMessage(this.$__("Item added to train")) - this.$router.push( - "/cgi-bin/koha/preservation/trains/" + - this.train.train_id - ) + this.$router.push({ + name: "TrainsShow", + params: { train_id: this.train.train_id }, + }) }, error => {} ) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItems.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItems.vue index 814ab7eb9b..a95840bd99 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItems.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsFormAddItems.vue @@ -90,7 +90,7 @@
    {{ $__("Cancel") }} @@ -138,14 +138,16 @@ export default { }, doShow: function (train, dt, event) { event.preventDefault() - this.$router.push( - "/cgi-bin/koha/preservation/trains/" + train.train_id - ) + this.$router.push({ + name: "TrainsShow", + params: { train_id: train.train_id }, + }) }, doEdit: function (train, dt, event) { - this.$router.push( - "/cgi-bin/koha/preservation/trains/edit/" + train.train_id - ) + this.$router.push({ + name: "TrainsFormEdit", + params: { train_id: train.train_id }, + }) }, doDelete: function (train, dt, event) { this.setConfirmationDialog( @@ -176,11 +178,10 @@ export default { if (train.closed_on != null) { this.setWarning(this.$__("Cannot add items to a closed train")) } else { - this.$router.push( - "/cgi-bin/koha/preservation/trains/" + - train.train_id + - "/items/add" - ) + this.$router.push({ + name: "TrainsFormAddItem", + params: { train_id: train.train_id }, + }) } }, table_url() { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue index 60ee1462a7..16d600ed49 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue @@ -50,7 +50,10 @@ {{ $__("Add items") }}
    {{ $__("Close") }} {} ) @@ -400,9 +404,10 @@ export default { ) }, editItem(train_item_id) { - this.$router.push( - `/cgi-bin/koha/preservation/trains/${this.train.train_id}/items/edit/${train_item_id}` - ) + this.$router.push({ + name: "TrainsFormEditItem", + params: { train_id: this.train.train_id, train_item_id }, + }) }, removeItem(train_item_id) { this.setConfirmationDialog( diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue index c62b0a1751..cb7340d3b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/WaitingList.vue @@ -191,12 +191,13 @@ export default { addItemsToTrain: function (e) { e.preventDefault() let item_ids = this.last_items.map(i => i.item_id) - this.$router.push( - "/cgi-bin/koha/preservation/trains/" + - this.train_id_selected_for_add + - "/items/add/" + - item_ids.join(",") - ) + this.$router.push({ + name: "TrainsFormAddItems", + params: { + train_id: this.train_id_selected_for_add, + item_ids: item_ids.join(","), + }, + }) }, addItemsToWaitingList: function (e) { e.preventDefault() diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js index f95d3705e1..8c220a4b10 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js @@ -75,6 +75,7 @@ export const routes = [ }, { path: "/cgi-bin/koha/preservation/home.pl", + name: "Home", component: Home, meta: { breadcrumb: () => [breadcrumbs.home, breadcrumbs.preservation_home], @@ -85,6 +86,7 @@ export const routes = [ children: [ { path: "", + name: "TrainsList", component: TrainsList, meta: { breadcrumb: () => breadcrumb_paths.trains, @@ -95,6 +97,7 @@ export const routes = [ children: [ { path: "", + name: "TrainsShow", component: TrainsShow, meta: { breadcrumb: () => @@ -109,6 +112,7 @@ export const routes = [ children: [ { path: "add", + name: "TrainsFormAddItem", component: TrainsFormAddItem, meta: { breadcrumb: () => @@ -120,6 +124,7 @@ export const routes = [ }, { path: "add/:item_ids", + name: "TrainsFormAddItems", component: TrainsFormAddItems, meta: { breadcrumb: () => @@ -131,6 +136,7 @@ export const routes = [ }, { path: "edit/:train_item_id", + name: "TrainsFormEditItem", component: TrainsFormAddItem, meta: { breadcrumb: () => @@ -146,6 +152,7 @@ export const routes = [ }, { path: "add", + name: "TrainsFormAdd", component: TrainsFormAdd, meta: { breadcrumb: () => @@ -157,6 +164,7 @@ export const routes = [ }, { path: "edit/:train_id", + name: "TrainsFormEdit", component: TrainsFormAdd, meta: { breadcrumb: () => @@ -170,6 +178,7 @@ export const routes = [ }, { path: "/cgi-bin/koha/preservation/waiting-list", + name: "WaitingList", component: WaitingList, meta: { breadcrumb: () => [ @@ -184,6 +193,7 @@ export const routes = [ children: [ { path: "", + name: "Settings", component: Settings, meta: { breadcrumb: () => breadcrumb_paths.settings, @@ -194,6 +204,7 @@ export const routes = [ children: [ { path: ":processing_id", + name: "SettingsProcessingsShow", component: SettingsProcessingsShow, meta: { breadcrumb: () => @@ -205,6 +216,7 @@ export const routes = [ }, { path: "add", + name: "SettingsProcessingsFormAdd", component: SettingsProcessingsFormAdd, meta: { breadcrumb: () => @@ -216,6 +228,7 @@ export const routes = [ }, { path: "edit/:processing_id", + name: "SettingsProcessingsFormEdit", component: SettingsProcessingsFormAdd, meta: { breadcrumb: () => -- 2.39.5