From ecbb6744a75733079952ab69e8bb4c2a80df0721 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 1 Oct 2025 14:26:58 +0200 Subject: [PATCH] readd renderif feature from commit d6bdad27b2a61d3d48d90f3571de6ca8e6c289ea to searchbar --- public/js/apps/Cis.js | 4 ++-- .../searchbar/result/template/action.js | 16 +++++++++++++++- .../searchbar/result/template/actions.js | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/public/js/apps/Cis.js b/public/js/apps/Cis.js index 73703b42b..5b76c5721 100644 --- a/public/js/apps/Cis.js +++ b/public/js/apps/Cis.js @@ -50,7 +50,7 @@ const app = Vue.createApp({ defaultaction: { type: "link", renderif: function(data) { - if(data.content_id === "N/A"){ + if(data.content_id === null){ return false; } return true; @@ -79,7 +79,7 @@ const app = Vue.createApp({ icon: "fas fa-info-circle", type: "link", renderif: function(data) { - if(data.content_id === "N/A"){ + if(data.content_id === null){ return false; } return true; diff --git a/public/js/components/searchbar/result/template/action.js b/public/js/components/searchbar/result/template/action.js index eb4b1db3a..fdcbfaee8 100644 --- a/public/js/components/searchbar/result/template/action.js +++ b/public/js/components/searchbar/result/template/action.js @@ -19,10 +19,24 @@ export default { if (this.action.type === 'function') this.action.action(this.res); this.$emit('actionexecuted'); + }, + renderif: function() { + if(this.action?.renderif === undefined) { + return true; + } + + return this.action.renderif(this.res); } }, template: ` + + ` }; \ No newline at end of file diff --git a/public/js/components/searchbar/result/template/actions.js b/public/js/components/searchbar/result/template/actions.js index 726fef4dd..8bfd08420 100644 --- a/public/js/components/searchbar/result/template/actions.js +++ b/public/js/components/searchbar/result/template/actions.js @@ -10,11 +10,20 @@ export default { res: Object, actions: Array }, + methods: { + renderif: function(action) { + if(action?.renderif === undefined) { + return true; + } + + return action.renderif(this.res); + } + }, template: `
+
` }; \ No newline at end of file