Ignore:
Timestamp:
03/09/14 14:23:42 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Enable/disable buttons on content change.
  • One place to do date formatting, because it was going wrong again.
  • Serialize questions in survey properly.
  • _ComplexValueMixin consumes submit events, but does trigger outer forms if present.
  • Trigger dialog show/hide for login only after previous effect is finished.
  • Check that documents are actually valid, not just that validator returned a result.
  • Validate email and timestamp formats.
  • Prepared for live runs.
File:
1 edited

Legend:

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

    r491 r492  
    2323            this._setupQuestionBrowser();
    2424            this._setupListView();
     25            this.questionList.on('change',lang.hitch(this,'_handleQuestionsChange'));
    2526            this._load();
    2627        },
     
    5859        _refresh: function() {
    5960            this.titleNode.innerHTML = this.object.title || "(set title in properties)";
    60             this.propertiesDialog.set('value',{survey:this.object});
     61            this.propertiesForm.set('value',{survey:this.object});
    6162            this.questionList.set('value',
    6263                                  this.object.questions);
    6364        },
    64         _save: function() {
    65             this.object.questions = this.questionList.get('value');
    66             return this.inherited(arguments);
    67         },
    6865        _includeQuestion: function(question) {
    6966            this.questionList.appendItem(question);
     67        },
     68        _handleQuestionsChange: function() {
     69            this.object.questions = this.questionList.get('value');
     70            this.markDirty();
     71            this._refresh();
    7072        },
    7173        _onShowProperties: function(evt) {
     
    7678        _onPropertiesOk: function(evt) {
    7779            this.propertiesDialog.hide();
    78             lang.mixin(this.object, this.propertiesDialog.get('value').survey);
     80            lang.mixin(this.object, this.propertiesForm.get('value').survey);
    7981            this.markDirty();
    8082            this._refresh();
     
    8486        _onPropertiesCancel: function(evt) {
    8587            this.propertiesDialog.hide();
    86             this.propertiesDialog.set('value',{survey:this.object});
     88            this.propertiesForm.set('value',{survey:this.object});
    8789            if ( evt ) { event.stop(evt); }
    8890            return false;
     
    109111                preview: true
    110112            });
     113        },
     114        markDirty: function() {
     115            this.saveBtn.set('disabled',false);
     116            this.saveAndCloseBtn.set('disabled',false);
     117            this.discardBtn.set('label','Discard & Close');
     118            this.inherited(arguments);
     119        },
     120        markClean: function() {
     121            this.saveBtn.set('disabled',true);
     122            this.saveAndCloseBtn.set('disabled',true);
     123            this.discardBtn.set('label','Close');
     124            this.inherited(arguments);
    111125        }
    112126    });
Note: See TracChangeset for help on using the changeset viewer.