do NOT call et2_ready for dialogs with a template, as it would overwrite this.et2 in app.js

This commit is contained in:
Ralf Becker 2016-03-21 15:31:02 +00:00
parent 374cfffb89
commit 77624244e6
2 changed files with 7 additions and 4 deletions

View File

@ -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, '-'));

View File

@ -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