Bugzilla – Attachment 149610 Details for
Bug 33529
Increase flexibility of action buttons in Vue Kohatables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33529: Update KohaTable to accept customised buttons
Bug-33529-Update-KohaTable-to-accept-customised-bu.patch (text/plain), 3.10 KB, created by
Matt Blenkinsop
on 2023-04-13 15:50:35 UTC
(
hide
)
Description:
Bug 33529: Update KohaTable to accept customised buttons
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2023-04-13 15:50:35 UTC
Size:
3.10 KB
patch
obsolete
>From f6e221287cc498ee5d808ec5444221fb8e71bb9e Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Thu, 13 Apr 2023 15:44:23 +0000 >Subject: [PATCH] Bug 33529: Update KohaTable to accept customised buttons > >This patch updates the KohaTable component to accept action buttons as objects rather than as hard coded strings. This allows buttons to be customised for different use cases > >Test plan: >1) Apply patch >2) Run yarn build >3) Navigate to Agreements - add an agreement if the table is empty >4) Test the buttons for editing and deleting agreements in the "Actions" column >5) Repeat for licenses >6) Repeat for local packages >7) Repeat for local titles >--- > .../prog/js/vue/components/KohaTable.vue | 24 +++++++------------ > 1 file changed, 8 insertions(+), 16 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >index 3e5d809ed0..c2cdeec0c0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >@@ -86,19 +86,11 @@ export default { > render: (data, type, row) => { > let content = [] > this.actions["-1"].forEach(a => { >- if (a == "edit") { >- content.push( >- '<a class="edit btn btn-default btn-xs" role="button"><i class="fa fa-pencil"></i>' + >- this.$__("Edit") + >- "</a>" >- ) >- } else if (a == "delete") { >- content.push( >- '<a class="delete btn btn-default btn-xs" role="button"><i class="fa fa-trash"></i>' + >- this.$__("Delete") + >- "</a>" >- ) >- } >+ content.push( >+ `<a class="${a.action} btn btn-default btn-xs" role="button"><i class="${a.icon}"></i>` + >+ this.$__(a.title) + >+ "</a>" >+ ) > }) > return content.join(" ") > }, >@@ -156,9 +148,9 @@ export default { > .to$() > .each(function (idx) { > const data = dataSet[idx] >- actions.forEach(action => { >- $("." + action, this).on("click", e => { >- self.$emit(action, data, dt, e) >+ actions.forEach(a => { >+ $("." + a.action, this).on("click", e => { >+ self.$emit(a.action, data, dt, e) > }) > }) > }) >-- >2.37.1 (Apple Git-137.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 33529
: 149610 |
149611