Changeset 410 for Dev/branches/rest-dojo-ui/client/rft/pages/viewSurvey.js
- Timestamp:
- 09/07/12 16:59:14 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/viewSurvey.js
r407 r410 13 13 templateString: template, 14 14 survey: null, 15 surveyId: "", 16 options: null, 15 17 constructor: function(){ 16 18 this._dataMap = {}; 19 this.options = this.options || {}; 17 20 }, 18 21 startup: function() { 19 22 if ( this._started ) { return; } 20 23 this.inherited(arguments); 24 25 21 26 if ( this.surveyId ) { 22 27 Deferred.when(store.get(this.surveyId)) 23 .then(lang.hitch(this,function(obj){ 28 .then(lang.hitch(this,function(survey){ 29 if ( !survey.published ) { 30 this.options.preview = true; 31 } 32 if ( this.options.preview ) { 33 this.buttonsPane.destroyRecursive(); 34 } 35 this.titleNode.innerHTML = survey.title + 36 (this.options.preview?' [preview]':''); 24 37 var f = new ContentWidgetFactory(); 25 this.survey = obj;38 this.survey = survey; 26 39 store.query(null,{keys:this.survey.questions,include_docs:true}) 27 40 .forEach(function(question){ … … 37 50 })); 38 51 } else { 39 throw "No valid uid or survey passed!";52 throw new Error("No valid uid or survey passed!"); 40 53 } 41 54 }, 42 55 _onSubmit: function(evt) { 56 if ( this.options.preview ) { return; } 43 57 var value = this.questionsForm.get('value'); 44 58 this.questionsPane.set('content','<pre>'+JSON.stringify(value)+'</pre>'); … … 47 61 }, 48 62 _onCancel: function(evt) { 63 if ( this.options.preview ) { return; } 49 64 event.stop(evt); 50 65 return false;
Note: See TracChangeset
for help on using the changeset viewer.