Changeset 416
- Timestamp:
- 12/04/12 17:36:50 (12 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client/rft/pages
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/session.js
r410 r416 22 22 this.inherited(arguments); 23 23 if ( this.sessionId ) { 24 this._loadSession(); 25 this._setupAutoComplete(); 26 } else { 27 throw "No valid uid or session passed!"; 28 } 29 }, 30 _loadSession: function() { 31 if ( this.sessionId === "new" ) { 32 this.session = { 33 type: 'SessionTemplate' 34 }; 35 } else { 24 36 Deferred.when(store.get(this.sessionId)) 25 37 .then(lang.hitch(this,function(obj){ … … 28 40 this._refresh(); 29 41 })); 30 this._setupAutoComplete();31 } else {32 throw "No valid uid or session passed!";33 42 } 34 43 }, -
Dev/branches/rest-dojo-ui/client/rft/pages/sessions.js
r410 r416 58 58 }, 59 59 onAddSessionTemplate: function(){ 60 store.put({ 61 type: 'SessionTemplate' 62 }) 63 .then(lang.hitch(this,function(obj){ 64 Router.go('/session/'+store.getIdentity(obj)); 65 })); 60 Router.go('/session/new'); 66 61 }, 67 62 _publishSession: function(sessionTemplate) { -
Dev/branches/rest-dojo-ui/client/rft/pages/survey.js
r410 r416 27 27 this._setupQuestionBrowser(); 28 28 this._setupListView(); 29 this._ setupSurvey();29 this._loadSurvey(); 30 30 } else { 31 31 throw "No valid uid or survey passed!"; … … 60 60 this.questionList.startup(); 61 61 }, 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 }; 68 67 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 } 70 77 }, 71 78 _includeQuestion: function(question) { -
Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js
r415 r416 19 19 }, 20 20 _onNewSurvey: function(){ 21 when( store.add({type:'Survey'}) ) 22 .then(function(survey) { 23 Router.go('/survey/'+store.getIdentity(survey)); 24 },function(err){ 25 Content.notify(err,'error'); 26 }); 21 Router.go('/survey/new'); 27 22 }, 28 23 _onPublishSurvey:function(survey){
Note: See TracChangeset
for help on using the changeset viewer.