Bugzilla – Attachment 146829 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: Add a confirmation message
Bug-32991-Add-a-confirmation-message.patch (text/plain), 8.01 KB, created by
Jonathan Druart
on 2023-02-17 11:28:46 UTC
(
hide
)
Description:
Bug 32991: Add a confirmation message
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-17 11:28:46 UTC
Size:
8.01 KB
patch
obsolete
>From 3e445d92a0796feff08779cda48d30b7b5626a6f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 17 Feb 2023 11:45:43 +0100 >Subject: [PATCH] Bug 32991: Add a confirmation message > >Looks easier to have a separate variable for the confirmation box, and >easier for styling as well. >--- > .../prog/js/vue/components/Dialog.vue | 53 +++++++++++++++---- > .../js/vue/components/ERM/AgreementsList.vue | 29 +++++----- > .../intranet-tmpl/prog/js/vue/stores/main.js | 21 +++++++- > 3 files changed, 78 insertions(+), 25 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Dialog.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Dialog.vue >index 995b9e6591c..6662075a0ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Dialog.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Dialog.vue >@@ -3,14 +3,6 @@ > <div class="dialog alert" v-if="error" v-html="error"></div> > <div class="dialog alert modal" v-if="warning"> > <span v-html="warning"></span> >- <a >- v-if="accept" >- id="close_modal" >- class="btn btn-primary btn-xs" >- role="button" >- @click="accept" >- >{{ $__("Accept") }}</a >- > > <a > id="close_modal" > class="btn btn-default btn-xs" >@@ -19,6 +11,26 @@ > >{{ $__("Close") }}</a > > > </div> >+ <div class="modal_centered" v-if="confirmation"> >+ <div class="dialog alert confirmation"> >+ <span v-html="confirmation"></span> >+ <a >+ v-if="accept" >+ id="close_modal" >+ class="btn btn-primary btn-xs" >+ role="button" >+ @click="accept" >+ >{{ $__("Accept") }}</a >+ > >+ <a >+ id="close_modal" >+ class="btn btn-default btn-xs" >+ role="button" >+ @click="removeMessages" >+ >{{ $__("Close") }}</a >+ > >+ </div> >+ </div> > <!-- Must be styled differently --> > > <div class="modal_centered" v-if="is_submitting"> >@@ -35,13 +47,21 @@ import { storeToRefs } from "pinia" > export default { > setup() { > const mainStore = inject("mainStore") >- const { message, error, warning, accept, is_submitting, is_loading } = >- storeToRefs(mainStore) >+ const { >+ message, >+ error, >+ warning, >+ confirmation, >+ accept, >+ is_submitting, >+ is_loading, >+ } = storeToRefs(mainStore) > const { removeMessages } = mainStore > return { > message, > error, > warning, >+ confirmation, > accept, > is_submitting, > is_loading, >@@ -84,4 +104,17 @@ export default { > left: 40%; > width: 10%; > } >+ >+.confirmation { >+ position: absolute; >+ top: 25%; >+ left: 40%; >+ >+ display: flex; >+ width: 50%; >+ min-height: 10%; >+ margin: auto; >+ align-items: center; >+ justify-content: center; >+} > </style> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >index 4c58a39581a..e03ed1e0772 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/AgreementsList.vue >@@ -49,7 +49,7 @@ export default { > const AVStore = inject("AVStore") > const { get_lib_from_av, map_av_dt_filter } = AVStore > >- const { setWarning, setMessage } = inject("mainStore") >+ const { setConfirmation, setMessage } = inject("mainStore") > > const table_id = "agreement_list" > useDataTable(table_id) >@@ -59,7 +59,7 @@ export default { > get_lib_from_av, > map_av_dt_filter, > table_id, >- setWarning, >+ setConfirmation, > setMessage, > } > }, >@@ -115,22 +115,25 @@ export default { > ) > }, > delete_agreement: function (agreement_id) { >- this.setWarning(this.$__("Are you sure you want to remove this agreement?"), () => { >- const client = APIClient.erm >- client.agreements.delete(agreement_id).then( >- success => { >- this.setMessage(this.$__("Agreement deleted")) >- this.refresh_table() >- }, >- error => {} >- ) >- }) >+ this.setConfirmation( >+ this.$__("Are you sure you want to remove this agreement?"), >+ () => { >+ const client = APIClient.erm >+ client.agreements.delete(agreement_id).then( >+ success => { >+ this.setMessage(this.$__("Agreement deleted")) >+ this.refresh_table() >+ }, >+ error => {} >+ ) >+ } >+ ) > }, > select_agreement: function (agreement_id) { > this.$emit("select-agreement", agreement_id) > this.$emit("close") > }, >- refresh_table: function(){ >+ refresh_table: function () { > $("#" + this.table_id) > .DataTable() > .ajax.url(this.datatable_url) >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >index 3a791860101..8938caf88d3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >@@ -5,6 +5,7 @@ export const useMainStore = defineStore("main", { > _message: null, > _error: null, > _warning: null, >+ _confirmation: null, > _accept: null, > previousMessage: null, > previousError: null, >@@ -17,30 +18,43 @@ export const useMainStore = defineStore("main", { > this._error = null; > this._warning = null; > this._message = message; >+ this._confirmation = null; > this.displayed_already = displayed; /* Will be displayed on the next view */ > }, > setError(error, displayed = true) { > this._error = error; >+ this._warning = null; > this._message = null; >+ this._confirmation = null; > this.displayed_already = displayed; /* Is displayed on the current view */ > }, > setWarning(warning, accept, displayed = true) { >+ this._error = null; >+ this._warning = warning; >+ this._message = null; >+ this._confirmation = null; >+ this.displayed_already = displayed; /* Is displayed on the current view */ >+ }, >+ setConfirmation(confirmation, accept, displayed = true){ > if(accept) { > this._accept = async () => { > await accept() > this.removeMessages() > } > } >- this._warning = warning; >+ this._error = null; >+ this._warning = null; > this._message = null; >+ this._confirmation = confirmation; > this.displayed_already = displayed; /* Is displayed on the current view */ > }, > removeMessages() { > if (this.displayed_already) { >- this._accept = null; > this._error = null; > this._warning = null; > this._message = null; >+ this._confirmation = null; >+ this._accept = null; > } > this.displayed_already = true; > }, >@@ -67,6 +81,9 @@ export const useMainStore = defineStore("main", { > message() { > return this._message > }, >+ confirmation() { >+ return this._confirmation >+ }, > accept() { > return this._accept > }, >-- >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 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