Ignore:
Timestamp:
03/09/14 19:25:40 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • _ComplexValueMixin propagates priorityChange to children.
  • Deserialize updated docs after save too.
  • Validate to false if definitions are missing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/pages/question.js

    r492 r493  
    2525        _refresh: function() {
    2626            this.titleNode.innerHTML = this.object.title || "";
    27             this.propertiesForm.set('value',this.object);
    28             this.contentList.set('value',this.object.content);
     27            this.propertiesForm.set('value',this.object,null);
     28            this.contentList.set('value',this.object.content,null);
    2929        },
    3030        _handlePropertiesChange: function() {
    31             lang.mixin(this.object,this.propertiesForm.get('value'));
     31            this._updateObject();
    3232            this.markDirty();
    3333            this._refresh();
    3434        },
    3535        _handleContentChange: function() {
    36             this.object.content = this.contentList.get('value');
     36            this._updateObject();
    3737            this.markDirty();
    3838            this._refresh();
    3939        },
     40        _updateObject: function() {
     41            var pValid = this.propertiesForm.validate();
     42            if ( pValid ) {
     43                lang.mixin(this.object,this.propertiesForm.get('value'));
     44            }
     45            var cValid = this.contentList.validate();
     46            if ( cValid ) {
     47                this.object.content = this.contentList.get('value');
     48            }
     49            this._isValid = pValid && cValid;
     50            return this._isValid;
     51        },
    4052        _save: function() {
    41             if ( this._isValid ) {
     53            if ( this._updateObject() ) {
    4254                return this.inherited(arguments);
    4355            } else {
     
    6577        },
    6678        markDirty: function() {
    67             this._isValid = this.propertiesForm.validate() &&
    68                             this.contentList.validate();
    6979            this.saveBtn.set('disabled',!this._isValid);
    7080            this.saveAndCloseBtn.set('disabled',!this._isValid);
     
    7383        },
    7484        markClean: function() {
    75             this._isValid = true;
    7685            this.saveBtn.set('disabled',true);
    7786            this.saveAndCloseBtn.set('disabled',true);
Note: See TracChangeset for help on using the changeset viewer.