isDirty() method for whole template / etemplate2 object, thought it needs more work in widgets, not setting this._oldValue in their set_value() method

This commit is contained in:
Ralf Becker 2013-08-23 15:15:30 +00:00
parent f4e1db3a68
commit d8984be747
2 changed files with 20 additions and 0 deletions

View File

@ -145,6 +145,8 @@ var et2_htmlarea = et2_inputWidget.extend(
} }
}, },
set_value: function(_value) { set_value: function(_value) {
this._oldValue = _value;
try { try {
//this.htmlNode.ckeditorGet().setData(_value); //this.htmlNode.ckeditorGet().setData(_value);
var ckeditor = CKEDITOR.instances[this.dom_id]; var ckeditor = CKEDITOR.instances[this.dom_id];

View File

@ -301,6 +301,24 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
}; };
/**
* Check if template contains any dirty (unsaved) content
*
* @returns {Boolean}
*/
etemplate2.prototype.isDirty = function()
{
var dirty = false;
this.widgetContainer.iterateOver(function(_widget) {
if (_widget.isDirty && _widget.isDirty())
{
dirty = true;
}
});
return dirty;
};
etemplate2.prototype.submit = function(button) etemplate2.prototype.submit = function(button)
{ {
// Get the form values // Get the form values