diff --git a/etemplate/js/et2_valueWidget.js b/etemplate/js/et2_valueWidget.js index fd0be0c3bb..ac6bde4a9a 100644 --- a/etemplate/js/et2_valueWidget.js +++ b/etemplate/js/et2_valueWidget.js @@ -34,7 +34,7 @@ var et2_valueWidget = et2_baseWidget.extend({ }, transformAttributes: function(_attrs) { - this._super.call(this, arguments); + this._super.apply(this, arguments); if (this.id != "") { diff --git a/etemplate/js/et2_widget.js b/etemplate/js/et2_widget.js index 3d74e71285..9a00716a10 100644 --- a/etemplate/js/et2_widget.js +++ b/etemplate/js/et2_widget.js @@ -483,12 +483,22 @@ var et2_widget = Class.extend({ } }, - transformAttributes: function() { + /** + * Apply the "modifications" to the element + */ + transformAttributes: function(_attrs) { + var data = this.getArrayMgr("modifications").getValueForID(this.id); + + if (data instanceof Object) + { + for (var key in data) + { + _attrs[key] = data[key]; + } + } }, createElementFromNode: function(_node) { - - // Fetch all attributes for this element from the XML node var attributes = {}; // Parse the "readonly" and "type" flag for this element here, as they diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 2a5cfb97b1..f00eb77193 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -85,12 +85,14 @@ etemplate2.prototype._createArrayManagers = function(_data) } // Create all neccessary _data entries - var neededEntries = ["content", "sel_options", "readonlys", "modifications", "validation_errors"]; + var neededEntries = ["content", "sel_options", "readonlys", "modifications", + "validation_errors"]; for (var i = 0; i < neededEntries.length; i++) { if (typeof _data[neededEntries[i]] == "undefined") { - et2_debug("log", "Created not passed entry '" + neededEntries[i] + "' in data array."); + et2_debug("log", "Created not passed entry '" + neededEntries[i] + + "' in data array."); _data[neededEntries[i]] = {}; } } diff --git a/etemplate/js/test/et2_test_timesheet_edit.json b/etemplate/js/test/et2_test_timesheet_edit.json index 51c6d9a925..f62e2547d2 100644 --- a/etemplate/js/test/et2_test_timesheet_edit.json +++ b/etemplate/js/test/et2_test_timesheet_edit.json @@ -77,6 +77,12 @@ var timesheet_data = { }, "validation_errors": { "ts_title": "Please enter some meaningful title here!" + }, + "modifications": { + "ts_quantity": { + "width": "200px", + "class": "blue" + } } } diff --git a/etemplate/js/test/et2_test_timesheet_edit.xet b/etemplate/js/test/et2_test_timesheet_edit.xet index f8c403e638..8918aa2bf4 100644 --- a/etemplate/js/test/et2_test_timesheet_edit.xet +++ b/etemplate/js/test/et2_test_timesheet_edit.xet @@ -205,6 +205,9 @@ .fullWidth select { widht: 100%; } .fullWidth input { widht: 100%; } .fullWidth textarea { widht: 100%; } + .blue { + background-color: #f0f0ff; + }