Ignore:
Timestamp:
06/09/13 17:27:20 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Improve SurveyRun? form and drop Fieldsets as widgets.

  • Improved console message on Page change fail.
  • Renamed some widgets, dropped having Fieldset widgets.
  • Put constraint that survey run start date cannot be before end date.
  • Link to survey from survey summary,
File:
1 edited

Legend:

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

    r443 r457  
    2121            if ( this._started ) { return; }
    2222            this.inherited(arguments);
    23             this.propertiesForm.on("blur",lang.hitch(this,'_onPropChange'));
     23            this.surveyRunWidget.on("blur",lang.hitch(this,'_onPropChange'));
    2424            if ( this.surveyRunId ) {
    2525                this._loadSurveyRun();
     
    3838        refreshSurveyRun: function() {
    3939            this.titleNode.innerHTML = SurveyRun.DisplayTitle.get(this.surveyRun);
    40             this.surveyNode.set('value',SurveyRun.Survey.get(this.surveyRun));
    41             this.propertiesForm.set('value',this.surveyRun);
     40            this.surveySummaryWidget.set('value',SurveyRun.Survey.get(this.surveyRun));
     41            this.surveyRunWidget.set('value',this.surveyRun);
    4242            this._onPropChange();
    4343        },
     
    7070        },
    7171        _onPropChange: function(e) {
    72             var surveyRun = this.propertiesForm.get('value');
     72            var surveyRun = this.surveyRunWidget.get('value');
    7373            if ( surveyRun.mode === "open" ) {
    7474                this.runURLNode.innerHTML = this._link(this._getGeneralURL(store.getIdentity(this.surveyRun)));
     
    8787        },
    8888        _onSave: function(evt) {
    89             lang.mixin(this.surveyRun,this.propertiesForm.get('value'));
    90             var not = function(p){ return !p; };
    91             func.modPropIf(this.surveyRun,"startDate",not.compose(lang.isString),store.formatDate);
    92             func.modPropIf(this.surveyRun,"endDate",not.compose(lang.isString),store.formatDate);
    93             store.put(this.surveyRun)
    94             .then(function() {
    95                 Router.go('/surveys');
    96             },function(err){
    97                 Content.notify(err);
    98             });
     89            if ( this.surveyRunWidget.validate() ) {
     90                lang.mixin(this.surveyRun,this.surveyRunWidget.get('value'));
     91
     92                var SD = SurveyRun.StartDate;
     93                var ED = SurveyRun.EndDate;
     94                SD.set(this.surveyRun, SD.get(this.surveyRun));
     95                ED.set(this.surveyRun, ED.get(this.surveyRun));
     96
     97                store.put(this.surveyRun)
     98                .then(function() {
     99                    Router.go('/surveys');
     100                },function(err){
     101                    Content.notify(err);
     102                });
     103            }
    99104            event.stop(evt);
    100105            return false;
Note: See TracChangeset for help on using the changeset viewer.