From b7be6140fa3dfab1b71ffaa7e37e5b550f5edf7c Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Mon, 23 Aug 2021 18:05:42 +0100 Subject: [PATCH 1/3] image field handler implementation --- .../crmSearchAdminDisplay.component.js | 13 ++++++++++++- .../crmSearchAdmin/displays/colType/field.html | 12 ++++++++++++ .../ang/crmSearchDisplay/colType/field.html | 5 ++++- .../traits/searchDisplayBaseTrait.service.js | 15 +++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/ext/search_kit/ang/crmSearchAdmin/crmSearchAdminDisplay.component.js b/ext/search_kit/ang/crmSearchAdmin/crmSearchAdminDisplay.component.js index 7ea85b38884a..515488687fbe 100644 --- a/ext/search_kit/ang/crmSearchAdmin/crmSearchAdminDisplay.component.js +++ b/ext/search_kit/ang/crmSearchAdmin/crmSearchAdminDisplay.component.js @@ -133,6 +133,17 @@ } }; + this.toggleImage = function(col) { + if (col.imageSrc) { + col.imageSrc = ''; + col.imageAlt = ''; + } else { + col.imageSrc = '[' + col.key + ']'; + col.imageAlt = '[' + col.key + ']'; + delete col.editable; + } + }; + this.toggleEditable = function(col) { if (col.editable) { delete col.editable; @@ -160,7 +171,7 @@ this.isEditable = function(col) { var expr = ctrl.getExprFromSelect(col.key), info = searchMeta.parseExpr(expr); - return !col.rewrite && !col.link && !info.fn && info.field && !info.field.readonly; + return !col.imageSrc && !col.rewrite && !col.link && !info.fn && info.field && !info.field.readonly; }; this.toggleLink = function(column) { diff --git a/ext/search_kit/ang/crmSearchAdmin/displays/colType/field.html b/ext/search_kit/ang/crmSearchAdmin/displays/colType/field.html index 8b0cbff69ec8..c942dec21285 100644 --- a/ext/search_kit/ang/crmSearchAdmin/displays/colType/field.html +++ b/ext/search_kit/ang/crmSearchAdmin/displays/colType/field.html @@ -19,6 +19,18 @@ +
+ +
+ + + + +
+
+ + diff --git a/ext/search_kit/ang/crmSearchDisplay/colType/field.html b/ext/search_kit/ang/crmSearchDisplay/colType/field.html index 94802191e15b..5586e94facef 100644 --- a/ext/search_kit/ang/crmSearchDisplay/colType/field.html +++ b/ext/search_kit/ang/crmSearchDisplay/colType/field.html @@ -10,5 +10,5 @@ - {{::  $ctrl.getImageAttribute(row, col, 'imageAlt') }} + {{::  $ctrl.getImageAttribute(row, col, 'imageAlt') }} From 7e781659e3d35bc4a8c03a07d0a5ac4e3071e346 Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Tue, 24 Aug 2021 13:33:57 +0100 Subject: [PATCH 3/3] do not render image if src is missing --- ext/search_kit/ang/crmSearchDisplay/colType/field.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/search_kit/ang/crmSearchDisplay/colType/field.html b/ext/search_kit/ang/crmSearchDisplay/colType/field.html index 5586e94facef..5d70d3e10138 100644 --- a/ext/search_kit/ang/crmSearchDisplay/colType/field.html +++ b/ext/search_kit/ang/crmSearchDisplay/colType/field.html @@ -10,5 +10,5 @@ - {{::  $ctrl.getImageAttribute(row, col, 'imageAlt') }} + {{::  $ctrl.getImageAttribute(row, col, 'imageAlt') }}