Bugzilla – Attachment 170478 Details for
Bug 37513
Disable 'Delete' button if the record source cannot be deleted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37513: Add a way for KohaTable to decide if a button should be displayed
Bug-37513-Add-a-way-for-KohaTable-to-decide-if-a-b.patch (text/plain), 2.48 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-08-19 17:58:12 UTC
(
hide
)
Description:
Bug 37513: Add a way for KohaTable to decide if a button should be displayed
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-08-19 17:58:12 UTC
Size:
2.48 KB
patch
obsolete
>From 4988cacabdc477265bc047111d8db6976285bdb3 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 19 Aug 2024 14:50:20 -0300 >Subject: [PATCH] Bug 37513: Add a way for KohaTable to decide if a button > should be displayed > >This patch adds, for the case of object parameters in the actions config >entry for the KohaTable Vue component, a check for a function on the >current row, that will be used to determine if a button needs to be >displayed or not. > >It checks for the function to be defined, and uses it for checking >displayability. >--- > .../prog/js/vue/components/KohaTable.vue | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 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 b988a2c7df6..d3a03bd9743 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >@@ -94,9 +94,21 @@ export default { > this.actions["-1"].forEach(action => { > if (typeof action === "object") { > let action_name = Object.keys(action)[0] >- content.push( >- `<a class="${action_name} btn btn-default btn-xs" role="button"><i class="${action[action_name].icon}"></i> ${action[action_name].text}</a>` >- ) >+ let should_display = true >+ >+ if ( >+ typeof action[action_name] >+ .should_display === "function" >+ ) { >+ should_display = >+ action[action_name].should_display(row) >+ } >+ >+ if (should_display) { >+ content.push( >+ `<a class="${action_name} btn btn-default btn-xs" role="button"><i class="${action[action_name].icon}"></i> ${action[action_name].text}</a>` >+ ) >+ } > } else if (action == "edit") { > content.push( > '<a class="edit btn btn-default btn-xs" role="button"><i class="fa fa-pencil"></i> ' + >-- >2.46.0
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 37513
:
170475
|
170476
|
170477
|
170478
|
170479
|
170512
|
170513
|
170514
|
170515
|
170516
|
170544
|
170545
|
170546
|
170547
|
170548
|
171205
|
171236