From ab0bf89d17e8fc627981d235e50450825e9d9555 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 1 Aug 2022 12:02:28 +0200 Subject: [PATCH] fix missing icons in quick_add after move of images also added invisible emptyLabel to not select first one --- api/js/jsapi/egw_links.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/api/js/jsapi/egw_links.js b/api/js/jsapi/egw_links.js index e32e041c71..997859d657 100644 --- a/api/js/jsapi/egw_links.js +++ b/api/js/jsapi/egw_links.js @@ -481,40 +481,43 @@ egw.extend('links', egw.MODULE_GLOBAL, function() */ link_quick_add: function(_parent) { - // check if quick-add selectbox is alread there, only create it again if not + // check if quick-add selectbox is already there, only create it again if not if (document.getElementById('quick_add_selectbox')) return; const select = document.createElement('et2-select'); select.setAttribute('id', 'quick_add_selectbox'); document.getElementById(_parent).append(select); - const self = this; // bind change handler - select.addEventListener('change', function(){ - if (this.value) self.open('', this.value, 'add', {}, undefined, this.value, true); + select.addEventListener('change', () => + { + if (select.value) this.open('', select.value, 'add', {}, undefined, select.value, true); + select.value = ''; }); // need to load common translations for app-names - this.langRequire(window, [{app: 'common', lang: this.preference('lang')}], function(){ - let options = []; - const apps = self.link_app_list('add'); + this.langRequire(window, [{app: 'common', lang: this.preference('lang')}], () => + { + let options = [{value:'', label: this.lang('Select one...')}]; + const apps = this.link_app_list('add'); for(let app in apps) { - if(egw.link_get_registry(app, 'no_quick_add')) + if(this.link_get_registry(app, 'no_quick_add')) { continue; } options.push({ value:app, - label:self.lang(self.link_get_registry(app,'entry') || apps[app]), - icon: `${egw.webserverUrl}/${app}/templates/pixelegg/images/navbar.svg` + label:this.lang(this.link_get_registry(app,'entry') || apps[app]), + icon: this.image('navbar', app) }); } select.select_options = options; - select.updateComplete.then(function(){ + select.updateComplete.then(() => + { select.dropdown.trigger.style.visibility = 'hidden'; select.dropdown.trigger.style.height = '0px'; + select.querySelector('sl-menu-item[value=""]').style.display = 'none'; }); - }); } - }; + } }); \ No newline at end of file