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.
Location:
Dev/trunk/src/client/qed-client/pages
Files:
3 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);
  • Dev/trunk/src/client/qed-client/pages/survey.js

    r492 r493  
    5959        _refresh: function() {
    6060            this.titleNode.innerHTML = this.object.title || "(set title in properties)";
    61             this.propertiesForm.set('value',{survey:this.object});
    62             this.questionList.set('value',
    63                                   this.object.questions);
     61            this.propertiesForm.set('value',{survey:this.object},null);
     62            this.questionList.set('value',this.object.questions,null);
    6463        },
    6564        _includeQuestion: function(question) {
  • Dev/trunk/src/client/qed-client/pages/surveyRun.js

    r492 r493  
    2222        templateString: template,
    2323        classStore: surveyRuns,
     24        _isValid: false,
    2425        startup: function() {
    2526            if ( this._started ) { return; }
     
    3031        _refresh: function() {
    3132            this.titleNode.innerHTML = this.object.title || "";
    32             this.surveySummaryWidget.set('value',this.object.survey);
    33             this.surveyRunWidget.set('value',this.object);
     33            this.surveySummaryWidget.set('value',this.object.survey,null);
     34            this.surveyRunWidget.set('value',this.object,null);
    3435            this._refreshURL();
    3536            this._loadResponses();
     
    9697        },
    9798        _updateObject: function() {
    98             var valid = this.surveyRunWidget.validate();
    99             if ( valid ) {
     99            this._isValid = this.surveyRunWidget.validate();
     100            if ( this._isValid ) {
    100101                lang.mixin(this.object,this.surveyRunWidget.get('value'));
    101102            }
    102             return valid;
     103            return this._isValid;
    103104        },
    104105        _onSave: function(evt) {
     
    122123        },
    123124        markDirty: function() {
    124             this.saveBtn.set('disabled',false);
    125             this.saveAndCloseBtn.set('disabled',false);
     125            this.saveBtn.set('disabled',!this._isValid);
     126            this.saveAndCloseBtn.set('disabled',!this._isValid);
    126127            this.discardBtn.set('label','Discard & Close');
    127128            this.inherited(arguments);
Note: See TracChangeset for help on using the changeset viewer.