Bugzilla – Attachment 147439 Details for
Bug 32991
Improve our Dialog component and remove routes for deletion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32991: Local titles: Add delete dialog to list and show. Removed FormConfirmDelete component and routes.
Bug-32991-Local-titles-Add-delete-dialog-to-list-a.patch (text/plain), 11.91 KB, created by
Pedro Amorim
on 2023-02-27 12:27:39 UTC
(
hide
)
Description:
Bug 32991: Local titles: Add delete dialog to list and show. Removed FormConfirmDelete component and routes.
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-02-27 12:27:39 UTC
Size:
11.91 KB
patch
obsolete
>From 66d663e14bd9d02339343fde5788524d8ddb6069 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 27 Feb 2023 11:08:35 +0000 >Subject: [PATCH] Bug 32991: Local titles: Add delete dialog to list and show. > Removed FormConfirmDelete component and routes. > >--- > .../EHoldingsLocalTitlesFormConfirmDelete.vue | 76 ------------------- > .../ERM/EHoldingsLocalTitlesList.vue | 42 +++++++++- > .../ERM/EHoldingsLocalTitlesShow.vue | 41 +++++++++- > .../intranet-tmpl/prog/js/vue/routes/erm.js | 17 ----- > 4 files changed, 75 insertions(+), 101 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue >deleted file mode 100644 >index 0e10e8eead..0000000000 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue >+++ /dev/null >@@ -1,76 +0,0 @@ >-<template> >- <div v-if="!initialized">{{ $__("Loading") }}</div> >- <div v-else id="eholdings_confirm_delete"> >- <h2>{{ $__("Delete title") }}</h2> >- <div> >- <form @submit="onSubmit($event)"> >- <fieldset class="rows"> >- <ol> >- <li> >- {{ $__("Title") }}: >- {{ title.publication_title }} >- </li> >- </ol> >- </fieldset> >- <fieldset class="action"> >- <input >- type="submit" >- variant="primary" >- :value="$__('Yes, delete')" >- /> >- <router-link >- to="/cgi-bin/koha/erm/eholdings/local/titles" >- role="button" >- class="cancel" >- >{{ $__("No, do not delete") }}</router-link >- > >- </fieldset> >- </form> >- </div> >- </div> >-</template> >- >-<script> >-import { APIClient } from "../../fetch/api-client.js" >-import { setMessage } from "../../messages" >- >-export default { >- data() { >- return { >- title: {}, >- initialized: false, >- } >- }, >- beforeRouteEnter(to, from, next) { >- next(vm => { >- vm.getTitle(to.params.title_id) >- }) >- }, >- methods: { >- getTitle(title_id) { >- const client = APIClient.erm >- client.localTitles.get(title_id).then( >- title => { >- this.title = title >- this.initialized = true >- }, >- error => {} >- ) >- }, >- onSubmit(e) { >- e.preventDefault() >- const client = APIClient.erm >- client.localTitles.delete(this.title.title_id).then( >- success => { >- setMessage(this.$__("Title deleted")) >- this.$router.push( >- "/cgi-bin/koha/erm/eholdings/local/titles" >- ) >- }, >- error => {} >- ) >- }, >- }, >- name: "EHoldingsLocalTitlesFormConfirmDelete", >-} >-</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue >index 90ab757f38..8dbd5a296e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue >@@ -30,6 +30,8 @@ export default { > const { av_title_publication_types } = storeToRefs(AVStore) > const { get_lib_from_av, map_av_dt_filter } = AVStore > >+ const { setConfirmationDialog, setMessage } = inject("mainStore") >+ > const table_id = "title_list" > useDataTable(table_id) > >@@ -38,6 +40,8 @@ export default { > get_lib_from_av, > map_av_dt_filter, > table_id, >+ setConfirmationDialog, >+ setMessage, > } > }, > data: function () { >@@ -77,9 +81,33 @@ export default { > "/cgi-bin/koha/erm/eholdings/local/titles/edit/" + title_id > ) > }, >- delete_title: function (title_id) { >- this.$router.push( >- "/cgi-bin/koha/erm/eholdings/local/titles/delete/" + title_id >+ delete_title: function (title_id, title_publication_title) { >+ this.setConfirmationDialog( >+ { >+ title: this.$__( >+ "Are you sure you want to remove this title?" >+ ), >+ message: title_publication_title, >+ accept_label: this.$__("Yes, delete"), >+ cancel_label: this.$__("No, do not delete"), >+ }, >+ () => { >+ const client = APIClient.erm >+ client.localTitles.delete(title_id).then( >+ success => { >+ this.setMessage( >+ this.$__("Local title %s deleted").format( >+ title_publication_title >+ ) >+ ) >+ $("#" + this.table_id) >+ .DataTable() >+ .ajax.url("/api/v1/erm/eholdings/local/titles") >+ .draw() >+ }, >+ error => {} >+ ) >+ } > ) > }, > build_datatable: function () { >@@ -193,6 +221,9 @@ export default { > function (index, e) { > let tr = $(this).parent().parent() > let title_id = api.row(tr).data().title_id >+ let title_publication_title = api >+ .row(tr) >+ .data().publication_title > let editButton = createVNode( > "a", > { >@@ -217,7 +248,10 @@ export default { > class: "btn btn-default btn-xs", > role: "button", > onClick: () => { >- delete_title(title_id) >+ delete_title( >+ title_id, >+ title_publication_title >+ ) > }, > }, > [ >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesShow.vue >index 59f0bf5104..7c55c24e5d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesShow.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesShow.vue >@@ -10,11 +10,12 @@ > ><i class="fa fa-pencil"></i > ></router-link> > >- <router-link >- :to="`/cgi-bin/koha/erm/eholdings/local/titles/delete/${title.title_id}`" >- :title="$__('Delete')" >+ <a >+ @click=" >+ delete_title(title.title_id, title.publication_title) >+ " > ><i class="fa fa-trash"></i >- ></router-link> >+ ></a> > </span> > </h2> > <div> >@@ -264,9 +265,12 @@ export default { > setup() { > const AVStore = inject("AVStore") > const { get_lib_from_av } = AVStore >+ const { setConfirmationDialog, setMessage } = inject("mainStore") > > return { > get_lib_from_av, >+ setConfirmationDialog, >+ setMessage, > } > }, > data() { >@@ -322,6 +326,34 @@ export default { > error => {} > ) > }, >+ delete_title: function (title_id, title_publication_title) { >+ this.setConfirmationDialog( >+ { >+ title: this.$__( >+ "Are you sure you want to remove this title?" >+ ), >+ message: title_publication_title, >+ accept_label: this.$__("Yes, delete"), >+ cancel_label: this.$__("No, do not delete"), >+ }, >+ () => { >+ const client = APIClient.erm >+ client.localTitles.delete(title_id).then( >+ success => { >+ this.setMessage( >+ this.$__("Local title %s deleted").format( >+ title_publication_title >+ ) >+ ) >+ this.$router.push( >+ "/cgi-bin/koha/erm/eholdings/local/titles" >+ ) >+ }, >+ error => {} >+ ) >+ } >+ ) >+ }, > }, > components: { > EHoldingsTitlePackagesList, >@@ -333,6 +365,7 @@ export default { > .action_links a { > padding-left: 0.2em; > font-size: 11px; >+ cursor: pointer; > } > fieldset.rows label { > width: 25rem; >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 1f3576db91..dd84078ea5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/erm.js >@@ -4,7 +4,6 @@ import AgreementsShow from "../components/ERM/AgreementsShow.vue"; > import AgreementsFormAdd from "../components/ERM/AgreementsFormAdd.vue"; > import AgreementsFormConfirmDelete from "../components/ERM/AgreementsFormConfirmDelete.vue"; > import EHoldingsLocalPackagesFormAdd from "../components/ERM/EHoldingsLocalPackagesFormAdd.vue"; >-import EHoldingsLocalTitlesFormConfirmDelete from "../components/ERM/EHoldingsLocalTitlesFormConfirmDelete.vue"; > import EHoldingsLocalTitlesFormAdd from "../components/ERM/EHoldingsLocalTitlesFormAdd.vue"; > import EHoldingsLocalTitlesFormImport from "../components/ERM/EHoldingsLocalTitlesFormImport.vue"; > import EHoldingsLocalPackagesList from "../components/ERM/EHoldingsLocalPackagesList.vue"; >@@ -314,22 +313,6 @@ export const routes = [ > ), > }, > }, >- { >- path: "delete/:title_id", >- component: >- EHoldingsLocalTitlesFormConfirmDelete, >- meta: { >- breadcrumb: () => >- build_breadcrumb( >- [ >- breadcrumb_paths.eholdings_local, >- breadcrumbs.eholdings.local >- .titles, >- ], >- "Delete title" // $t("Delete title") >- ), >- }, >- }, > { > path: "add", > component: EHoldingsLocalTitlesFormAdd, >-- >2.30.2
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 32991
:
146828
|
146829
|
147051
|
147052
|
147053
|
147054
|
147082
|
147083
|
147281
|
147282
|
147291
|
147305
|
147350
|
147383
|
147384
|
147385
|
147387
|
147388
|
147389
|
147390
|
147391
|
147392
|
147393
|
147394
|
147429
|
147439
|
147445
|
147447
|
147448
|
147449
|
147450
|
147451
|
147452
|
147453
|
147454
|
147455
|
147456
|
147461
|
147483
|
147485
|
147486
|
147487
|
147542
|
147543
|
147544
|
147545
|
147546
|
147547
|
147548
|
147549
|
147550
|
147551
|
147552
|
147553
|
147554
|
147569
|
147573
|
147584
|
147588
|
147589
|
147590
|
147591
|
147592
|
147593
|
147594
|
147595
|
147596
|
147597
|
147598
|
147599
|
147600
|
147601
|
147602
|
147603
|
147604
|
147937
|
147938
|
147939
|
147940
|
147941
|
147942
|
147943
|
147944
|
147945
|
147946
|
147947
|
147948
|
147949
|
147950
|
147951