From 77624244e682c7c8197a53e7f1aafd234392ba92 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 21 Mar 2016 15:31:02 +0000 Subject: [PATCH] do NOT call et2_ready for dialogs with a template, as it would overwrite this.et2 in app.js --- api/js/etemplate/et2_widget_dialog.js | 4 +++- api/js/etemplate/etemplate2.js | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/js/etemplate/et2_widget_dialog.js b/api/js/etemplate/et2_widget_dialog.js index 850677b526..017c78b476 100644 --- a/api/js/etemplate/et2_widget_dialog.js +++ b/api/js/etemplate/et2_widget_dialog.js @@ -428,7 +428,9 @@ var et2_dialog = (function(){ "use strict"; return et2_widget.extend( else { // Just template name, it better be loaded already - this.template.load(template,'',this.options.value||{}); + this.template.load(template, '', this.options.value || {}, + // true: do NOT call et2_ready, as it would overwrite this.et2 in app.js + undefined, undefined, true); } // set template-name as id, to allow to style dialogs this.div.children().attr('id', template.replace(/^(.*\/)?([^/]+)(\.xet)?$/, '$2').replace(/\./g, '-')); diff --git a/api/js/etemplate/etemplate2.js b/api/js/etemplate/etemplate2.js index e23c94fbcb..23d720517c 100644 --- a/api/js/etemplate/etemplate2.js +++ b/api/js/etemplate/etemplate2.js @@ -333,8 +333,9 @@ etemplate2.prototype.download = function(_url) * @param {object} _data object with attributes content, langRequire, etemplate_exec_id, ... * @param {function} _callback called after tempalte is loaded * @param {object} _app local app object + * @param {boolean} _no_et2_ready true: do not send et2_ready, used by et2_dialog to not overwrite app.js et2 object */ -etemplate2.prototype.load = function(_name, _url, _data, _callback, _app) +etemplate2.prototype.load = function(_name, _url, _data, _callback, _app, _no_et2_ready) { var app = _app || window.app; this.name = _name; // store top-level template name to have it available in widgets @@ -529,11 +530,11 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback, _app) { _callback.call(window,this,_name); } - if(app_callback && _callback != app_callback) + if(app_callback && _callback != app_callback && !_no_et2_ready) { app_callback.call(window,this,_name); } - if(appname && appname != this.app && typeof app[this.app] == "object") + if(appname && appname != this.app && typeof app[this.app] == "object" && !_no_et2_ready) { // Loaded a template from a different application? // Let the application that loaded it know too