From 5a021bdae83ea981b3f8da3c1dd3b08cf715536c Mon Sep 17 00:00:00 2001 From: milan Date: Mon, 5 Aug 2024 19:24:07 +0200 Subject: [PATCH] fix bug in Et2Tree where tree would not consider imagePath --- api/js/etemplate/Et2Tree/Et2Tree.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index ecc6f1327c..5984e2264c 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -113,7 +113,7 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin @property({type: Function}) onopenend //description: "Javascript function executed when opening a node is finished: function(_id, _widget, _hasChildren)" @property({type: String}) - imagePath: String = egw().webserverUrl + "/api/templates/default/images/dhtmlxtree/" //TODO we will need a different path here! maybe just rename the path? + imagePath: string = egw().webserverUrl + "/api/templates/default/images/dhtmlxtree/" //TODO we will need a different path here! maybe just rename the path? // description: "Directory for tree structure images, set on server-side to 'dhtmlx' subdir of templates image-directory" @property() value = [] @@ -871,6 +871,11 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin //sl-icon images need to be svgs if there is a png try to find the corresponding svg img = img.replace(".png", ".svg"); } + //append image path if it was not set by the server already + if (!img.startsWith(this.imagePath)) + { + img = this.imagePath + img; + } // lazy iff "child" is set and "item" is empty or item does not exist in the first place const lazy = (selectOption.item?.length === 0 && selectOption.child) || (selectOption.child && !selectOption.item)