partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 521932c734f5ab95162dedf5bab9ceeeba0964d8
parent 3f54b6d5defca9354b4ecbe7aa30db52685f2295
Author: Felicitus <felicitus@felicitus.org>
Date:   Mon, 12 Mar 2012 09:39:02 +0100

Added some documentation regarding the onItemSave method.

Diffstat:
Msrc/frontend/js/Components/Part/Editor/PartEditor.js | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/frontend/js/Components/Part/Editor/PartEditor.js b/src/frontend/js/Components/Part/Editor/PartEditor.js @@ -212,9 +212,17 @@ Ext.define('PartKeepr.PartEditor', { this.on("itemSave", this.onItemSave, this); }, + /** + * Cleans up the record prior saving. + */ onItemSave: function () { var removeRecords = [], j; + /** + * Iterate through all records and check if a valid distributor + * ID is assigned. If not, the record is removed as it is assumed + * that the record is invalid and being removed. + */ for (j=0;j<this.record.distributors().getCount();j++) { if (this.record.distributors().getAt(j).get("id") === 0) { removeRecords.push(this.record.distributors().getAt(j)); @@ -227,6 +235,12 @@ Ext.define('PartKeepr.PartEditor', { removeRecords = []; + /** + * Iterate through all records and check if a valid parameter + * ID is assigned. If not, the record is removed as it is assumed + * that the record is invalid and being removed. + */ + for (j=0;j<this.record.parameters().getCount();j++) { if (this.record.parameters().getAt(j).get("id") === 0) { removeRecords.push(this.record.parameters().getAt(j)); @@ -239,6 +253,12 @@ Ext.define('PartKeepr.PartEditor', { removeRecords = []; + /** + * Iterate through all records and check if a valid manufacturer + * ID is assigned. If not, the record is removed as it is assumed + * that the record is invalid and being removed. + */ + for (j=0;j<this.record.manufacturers().getCount();j++) { if (this.record.manufacturers().getAt(j).get("id") === 0) { removeRecords.push(this.record.manufacturers().getAt(j));