Ignore:
Timestamp:
12/04/12 17:36:50 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Don't create new documents before editing them, because
our validation will reject them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/rft/pages/survey.js

    r410 r416  
    2727                this._setupQuestionBrowser();
    2828                this._setupListView();
    29                 this._setupSurvey();
     29                this._loadSurvey();
    3030            } else {
    3131                throw "No valid uid or survey passed!";
     
    6060            this.questionList.startup();
    6161        },
    62         _setupSurvey: function() {
    63             Deferred.when(store.get(this.surveyId))
    64             .then(lang.hitch(this,function(survey){
    65                 this.survey = survey;
    66                 store.query(null,{keys:this.survey.questions || [], include_docs: true})
    67                 .forEach(lang.hitch(this.questionList,'appendItem'));
     62        _loadSurvey: function() {
     63            if ( this.surveyId === "new" ) {
     64                this.survey = {
     65                    type: 'Survey'
     66                };
    6867                this.refresh();
    69             }));
     68            } else {
     69                Deferred.when(store.get(this.surveyId))
     70                .then(lang.hitch(this,function(survey){
     71                    this.survey = survey;
     72                    store.query(null,{keys:this.survey.questions || [], include_docs: true})
     73                    .forEach(lang.hitch(this.questionList,'appendItem'));
     74                    this.refresh();
     75                }));
     76            }
    7077        },
    7178        _includeQuestion: function(question) {
Note: See TracChangeset for help on using the changeset viewer.