Changeset 343 for Dev/branches/rest-dojo-ui/client/rft/pages
- Timestamp:
- 06/18/12 12:51:58 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client/rft/pages
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r316 r343 8 8 }, 9 9 onVisit: function() { 10 this._store = store.getStore('Question');11 10 this._list = new AccordionList({ 12 11 actions: { 13 12 'Edit': lang.hitch(this,'_editQuestion') 14 13 }, 15 idProperty: this._store.idProperty,14 idProperty: store.idProperty, 16 15 categoryProperty: 'category', 17 16 titleProperty: 'title' … … 21 20 }, 22 21 _refresh: function() { 23 Deferred.when( this._store.query())22 Deferred.when(store.query('_design/default/_view/by_type',{key: 'Question'})) 24 23 .then(lang.hitch(this,function(items){ 25 24 this._list.setItems(items); … … 27 26 }, 28 27 onNewQuestion: function() { 29 Deferred.when( this._store.add({}))28 Deferred.when(store.add({type:'Question'})) 30 29 .then(lang.hitch(this,function(question){ 31 30 this._editQuestion(question); … … 39 38 onSaveQuestion: function(evt) { 40 39 var value = this.questionWidget.get('value'); 41 Deferred.when( this._store.put(value))40 Deferred.when(store.put(value)) 42 41 .then(lang.hitch(this,function(){ 43 42 this.questionDialog.hide(); -
Dev/branches/rest-dojo-ui/client/rft/pages/survey.js
r316 r343 5 5 return declare('rft.pages.survey',[_Page],{ 6 6 object: null, 7 postCreate: function() {8 this.inherited(arguments);9 this._surveyStore = store.getStore('Survey');10 this._questionStore = store.getStore('Question');11 },12 7 onVisit: function() { 13 8 if ( this.pageArgs.uid ) { 14 Deferred.when( this._surveyStore.get(this.pageArgs.uid))9 Deferred.when(store.get(this.pageArgs.uid)) 15 10 .then(lang.hitch(this,function(obj){ 16 11 this.object = obj; … … 21 16 this.creator.innerHTML = (obj && obj.email) || 'unknown'; 22 17 })); 23 Deferred.when( this._questionStore.query())18 Deferred.when(store.query('_design/default/_view/by_type',{key:'Question'})) 24 19 .then(lang.hitch(this,function(items){ 25 20 this._questionList = new AccordionList({ 26 store: this._surveyStore,27 21 actions: { 28 22 'Add': lang.hitch(this,'_addQuestion') 29 23 }, 30 idProperty: this._questionStore.idProperty,31 24 categoryProperty: 'category', 32 25 titleProperty: 'title' … … 44 37 onSave: function(evt) { 45 38 lang.mixin(this.object,this.form.get('value')); 46 Deferred.when( this._store.put(this.object) )39 Deferred.when( store.put(this.object) ) 47 40 .then(lang.hitch(this,function(obj){ 48 41 this.object = obj; … … 53 46 })); 54 47 event.stop(evt); 48 evt.stopPropagation(); 55 49 return false; 56 50 }, -
Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js
r303 r343 3 3 return declare('rft.pages.surveys',[_Page],{ 4 4 selectedObject: null, 5 postCreate: function() {6 this._store = store.getStore('Survey');7 },8 5 onVisit: function() { 9 this.grid.setStore(ObjectStore({objectStore: this._store})); 6 this.grid.setStore( 7 ObjectStore({objectStore: store}), 8 "_design/default/_view/by_type",{key:'Survey'}); 10 9 11 10 this.grid.on('rowclick',lang.hitch(this,function(evt){ … … 16 15 this.grid.on('rowdblclick',lang.hitch(this,function(evt){ 17 16 var obj = evt.grid.getItem(evt.rowIndex); 18 content.goTo('/survey',{uid: obj.getUid()});17 content.goTo('/survey',{uid:store.getIdentity(obj)}); 19 18 })); 20 19 21 20 this.btnNew.on('click',lang.hitch(this,function(){ 22 Deferred.when( this._store.add({'creator':auth.getUser()}) )21 Deferred.when( store.add({type:'Survey',creator:auth.getUser()}) ) 23 22 .then(function(obj) { 24 content.goTo('/survey',{uid: obj.getUid()});23 content.goTo('/survey',{uid:store.getIdentity(obj)}); 25 24 }); 26 25 })); … … 28 27 this.btnEdit.on('click',lang.hitch(this,function(){ 29 28 if ( this.selectedObject ) { 30 content.goTo('/survey',{uid: this.selectedObject.getUid()});29 content.goTo('/survey',{uid:store.getIdentity(this.selectedObject)}); 31 30 } 32 31
Note: See TracChangeset
for help on using the changeset viewer.