Bugzilla – Attachment 168741 Details for
Bug 37301
Further improve how we build Vue components
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37301: Restore to
Bug-37301-Restore-to.patch (text/plain), 4.55 KB, created by
Jonathan Druart
on 2024-07-10 13:33:17 UTC
(
hide
)
Description:
Bug 37301: Restore to
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-07-10 13:33:17 UTC
Size:
4.55 KB
patch
obsolete
>From e255d9921723bb84230861b80d242dbe244a8485 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 10 Jul 2024 15:00:21 +0200 >Subject: [PATCH] Bug 37301: Restore to > >For discussion. > >I quite liked it, we didn't need an extra method. > >The problem I can see is that edit and add behave differently that >delete. Is that a problem? > >If we drop this patch we need to decide a better wording: editAgreement >is IMO the action of editing an agreement. Here I think we need maybe >goToEditResourceForm and goToAddResourceform for the event names. >--- > .../prog/js/vue/components/ERM/AgreementsList.vue | 7 +------ > .../prog/js/vue/components/ERM/AgreementsShow.vue | 14 +++++++------- > .../prog/js/vue/components/ToolbarButton.vue | 14 ++++++++------ > 3 files changed, 16 insertions(+), 19 deletions(-) > >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 07d3e5c7ba8..a702c89f882 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 >@@ -4,7 +4,7 @@ > <Toolbar v-if="!embedded"> > <ToolbarButton > action="add" >- @addResource="add_agreement" >+ :to="{ name: 'AgreementsFormAdd' }" > :title="$__('New agreement')" > /> > </Toolbar> >@@ -174,11 +174,6 @@ export default { > error => {} > ) > }, >- add_agreement: function () { >- this.$router.push({ >- name: "AgreementsFormAdd", >- }) >- }, > doShow: function ({ agreement_id }, dt, event) { > event.preventDefault() > this.$router.push({ >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 75b8cd72306..ef35203a1fd 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 >@@ -2,7 +2,13 @@ > <div v-if="!initialized">{{ $__("Loading") }}</div> > <div v-else id="agreements_show"> > <Toolbar> >- <ToolbarButton action="edit" @editResource="edit_agreement" /> >+ <ToolbarButton >+ action="edit" >+ :to="{ >+ name: 'AgreementsFormAddEdit', >+ params: { agreement_id: agreement.agreement_id }, >+ }" >+ /> > <ToolbarButton action="delete" @deleteResource="delete_agreement" /> > </Toolbar> > >@@ -383,12 +389,6 @@ export default { > error => {} > ) > }, >- edit_agreement: function () { >- this.$router.push({ >- name: "AgreementsFormAddEdit", >- params: { agreement_id: this.agreement.agreement_id }, >- }) >- }, > delete_agreement: function () { > let agreement_id = this.agreement.agreement_id > let agreement_name = this.agreement.name >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ToolbarButton.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ToolbarButton.vue >index d6c535284fc..4b35e346782 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ToolbarButton.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ToolbarButton.vue >@@ -1,5 +1,5 @@ > <template> >- <a v-if="action === 'add'" @click="$emit('addResource')" :class="class" >+ <a v-if="action === 'add'" @click="goTo" :class="class" > ><font-awesome-icon icon="plus" /> {{ title }}</a > > > <a >@@ -8,10 +8,7 @@ > :class="class" > ><font-awesome-icon icon="trash" /> {{ $__("Delete") }}</a > > >- <a >- v-else-if="action === 'edit'" >- @click="$emit('editResource')" >- :class="class" >+ <a v-else-if="action === 'edit'" @click="goTo" :class="class" > ><font-awesome-icon icon="pencil" /> {{ $__("Edit") }}</a > > > <span v-else>{{ $__("Unknown action %s").format(action) }}</span> >@@ -19,6 +16,11 @@ > > <script> > export default { >+ methods: { >+ goTo: function () { >+ this.$router.push(this.to) >+ }, >+ }, > props: { > action: { > type: String, >@@ -39,7 +41,7 @@ export default { > type: String, > }, > }, >- emits: ["addResource", "deleteResource", "editResource"], >+ emits: ["deleteResource"], > name: "Toolbar", > } > </script> >-- >2.34.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 37301
:
168709
|
168739
|
168740
|
168741
|
168800
|
168827
|
168828
|
168829
|
168836
|
172713
|
172911
|
172912
|
172913
|
172914
|
172915
|
172916
|
172917
|
172918
|
172919
|
172920
|
172921
|
174612
|
174613
|
174614
|
174615
|
174616
|
174617
|
174618
|
174619
|
174620
|
174621
|
174622
|
174623
|
174624
|
174625
|
174626
|
174627
|
174628
|
174629
|
174630
|
174631
|
175450
|
177173
|
177174
|
177175
|
177176
|
177177
|
177178
|
177179
|
177180
|
177181
|
177182
|
177183
|
177184
|
177185
|
177186
|
177187
|
177188
|
177189
|
177190
|
177191
|
177192
|
177193
|
177351