diff --git a/api/js/etemplate/Et2Dialog/Et2Dialog.ts b/api/js/etemplate/Et2Dialog/Et2Dialog.ts index a3aca525e5..4332196d29 100644 --- a/api/js/etemplate/Et2Dialog/Et2Dialog.ts +++ b/api/js/etemplate/Et2Dialog/Et2Dialog.ts @@ -948,7 +948,7 @@ export class Et2Dialog extends Et2Widget(SlotMixin(SlDialog)) _adoptTemplateButtons() { // Check for something with buttons slot set - let search_in = (this._template_widget?.DOMContainer || this._contentNode); + let search_in = (this._template_widget?.DOMContainer ?? this._contentNode); if(!search_in) { return; @@ -1022,7 +1022,7 @@ export class Et2Dialog extends Et2Widget(SlotMixin(SlDialog)) get _contentNode() : HTMLElement { - return this.querySelector('.dialog_content'); + return this.querySelector('.dialog_content') ?? this.querySelector("*"); } _setupMoveResize() diff --git a/api/js/etemplate/etemplate2.ts b/api/js/etemplate/etemplate2.ts index 4a3c14c81c..96e570201c 100644 --- a/api/js/etemplate/etemplate2.ts +++ b/api/js/etemplate/etemplate2.ts @@ -1617,7 +1617,14 @@ export class etemplate2 uniqueId = data.DOMNodeID.replace('.', '-') + '-' + data['open_target']; } const et2 = new etemplate2(node, data.data.menuaction, uniqueId); - return et2.load(data.name, data.url, data.data, null, null, null, data['fw-target']); + return et2.load(data.name, data.url, data.data, null, null, null, data['fw-target']) + .then(() => + { + if(dialog) + { + dialog._adoptTemplateButtons(); + } + }); } else { diff --git a/calendar/js/app.ts b/calendar/js/app.ts index bdffe8466a..aa521681a4 100644 --- a/calendar/js/app.ts +++ b/calendar/js/app.ts @@ -2061,45 +2061,21 @@ export class CalendarApp extends EgwApp this.quick_add = options; // Open dialog to use as target - let add_dialog = Et2Dialog.show_dialog(null, '', 'Add new event', null, [], Et2Dialog.PLAIN_MESSAGE, "", this.egw); - add_dialog.id = "quick_add"; - // Position by the event - if(event) - { - add_dialog.config = {...add_dialog.config, referenceNode: event.getDOMNode()}; - } + let add_dialog; // Call the server, get it into the dialog options = jQuery.extend({menuaction: 'calendar.calendar_uiforms.ajax_add', template: 'calendar.add'}, options); this.egw.json( this.egw.link('/json.php', options), [options], - function(data) + (data) => { - if(data.type) + if(Array.isArray(data) && typeof data[0] === 'string') { - return false; - } - var content = { - html: data[0], - js: '' - }; - - egw_seperateJavaScript(content); - - // Check for right template in the response - if(content.html.indexOf('calendar-add') <= 0) - { - return false; - } - // Insert the content into the correct place - add_dialog._contentNode.replaceChildren(); - add_dialog._contentNode.insertAdjacentHTML("beforeend", content.html); - let template = add_dialog.querySelector("[id='calendar-add']"); - if(template) - { - template.addEventListener("load", add_dialog._adoptTemplateButtons); + jQuery(data[0]).appendTo(document.body); } + add_dialog = document.body.querySelector("et2-dialog"); + add_dialog.id = "quick-add"; } ).sendRequest(); @@ -2162,7 +2138,7 @@ export class CalendarApp extends EgwApp if(invalid.filter((widget) => widget).length == 0) { // Close the dialog, if everything is OK - (document.querySelector('et2-dialog#quick_add')).hide(); + (document.querySelector('et2-dialog')).hide(); } }); diff --git a/calendar/templates/default/add.xet b/calendar/templates/default/add.xet index e450cd68b0..17951b0b45 100644 --- a/calendar/templates/default/add.xet +++ b/calendar/templates/default/add.xet @@ -16,17 +16,17 @@ - - - - - + + + + + - - - - + + + + \ No newline at end of file