Changeset 303 for Dev/branches/rest-dojo-ui/client/rft/pages
- Timestamp:
- 03/04/12 15:48:42 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client/rft/pages
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r288 r303 1 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/_base/event', 2 'dojo/_base/Deferred','dojo/dom-construct',' dojo/store/JsonRest','dijit/layout/ContentPane','dijit/TitlePane',2 'dojo/_base/Deferred','dojo/dom-construct','rft/store','dijit/TitlePane', 3 3 'rft/ui/_Page','rft/ui/LineWithActionsWidget'], 4 function(declare,lang,array,event,Deferred,domConstruct, JsonRest,ContentPane,TitlePane,_Page,LineWithActionsWidget) {4 function(declare,lang,array,event,Deferred,domConstruct,store,TitlePane,_Page,LineWithActionsWidget) { 5 5 return declare('rft.pages.questions',[_Page],{ 6 6 constructor: function() { … … 9 9 }, 10 10 onVisit: function() { 11 this._store = new JsonRest({ 12 target:"../server/api.php/data/Question/", 13 idProperty: 'uid' 14 }); 11 this._store = store.getStore('Question'); 15 12 this._refresh(true); 16 13 }, 17 14 _refresh: function(initial) { 18 Deferred.when( this._store.query() ).then(lang.hitch(this,function(results){ 15 Deferred.when( this._store.query() ) 16 .then(lang.hitch(this,function(results){ 19 17 array.forEach(results,lang.hitch(this,'_addQuestion')); 20 18 initial && this.accordion.selectChild(true); … … 22 20 }, 23 21 _addQuestion: function(q) { 24 var uid = q. uid;22 var uid = q.getUid(); 25 23 var question = this.questions[uid]; 26 24 if ( !question ) { … … 54 52 var placeNode = this.accordion.domNode; 55 53 var placePos = 'last'; 56 array.some(widgets,lang.hitch(this,function(widget ,idx) {54 array.some(widgets,lang.hitch(this,function(widget) { 57 55 if ( widget.title == category ) { 58 56 containerWidget = widget; -
Dev/branches/rest-dojo-ui/client/rft/pages/sessions.html
r274 r303 24 24 var submitHandler = lang.hitch(that,function(evt){ 25 25 var newObj = this.form.get('value'); 26 debugger;27 26 // mixin newObj in obj. 28 27 // store.put(newObj); -
Dev/branches/rest-dojo-ui/client/rft/pages/survey.html
r292 r303 1 1 <div data-dojo-type="rft.pages.survey"> 2 2 <h1 data-rft-attach-point="header">(default)</h1> 3 <div>Created by <span data-rft-attach-point="creator"></span><div> 3 4 <form data-dojo-type="dijit.form.Form" data-rft-attach-point="form" data-rft-attach-event="onSubmit:onSave"> 4 5 <div style="display: block; clear: both;"> -
Dev/branches/rest-dojo-ui/client/rft/pages/survey.js
r292 r303 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event','dojo/_base/Deferred',' dojo/store/JsonRest','rft/ui/_Page'],2 function(declare,lang,event,Deferred, JsonRest,_Page){1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event','dojo/_base/Deferred','rft/store','rft/ui/_Page'], 2 function(declare,lang,event,Deferred,store,_Page){ 3 3 return declare('rft.pages.survey',[_Page],{ 4 4 object: null, 5 5 postCreate: function() { 6 6 this.inherited(arguments); 7 this._store = new JsonRest({ 8 target:"../server/api.php/data/Survey/", 9 idProperty: 'uid' 10 }); 7 this._store = store.getStore('Survey'); 11 8 }, 12 9 onVisit: function() { … … 16 13 this.object = obj; 17 14 this.setFields(obj); 15 return Deferred.when( obj.creator && store.dereference(obj.creator) ); 16 })) 17 .then(lang.hitch(this,function(obj){ 18 this.creator.innerHTML = (obj && obj.email) || 'unknown'; 18 19 })); 19 20 } else { -
Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js
r292 r303 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/ store/JsonRest','dojo/data/ObjectStore','rft/content','rft/ui/_Page'],2 function(declare,lang, JsonRest,ObjectStore,content,_Page){1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/Deferred','dojo/data/ObjectStore','rft/auth','rft/store','rft/content','rft/ui/_Page'], 2 function(declare,lang,Deferred,ObjectStore,auth,store,content,_Page){ 3 3 return declare('rft.pages.surveys',[_Page],{ 4 4 selectedObject: null, 5 5 postCreate: function() { 6 this._store = new JsonRest({ 7 target:"../server/api.php/data/Survey/", 8 idProperty: 'uid' 9 }); 6 this._store = store.getStore('Survey'); 10 7 }, 11 8 onVisit: function() { … … 14 11 this.grid.on('rowclick',lang.hitch(this,function(evt){ 15 12 this.selectedObject = evt.grid.getItem(evt.rowIndex); 16 this.btnEdit.set('disabled',! !this.selectedObject);13 this.btnEdit.set('disabled',!this.selectedObject); 17 14 })); 18 15 19 16 this.grid.on('rowdblclick',lang.hitch(this,function(evt){ 20 17 var obj = evt.grid.getItem(evt.rowIndex); 21 content.goTo('/survey',{uid:obj. uid});18 content.goTo('/survey',{uid:obj.getUid()}); 22 19 })); 23 20 24 21 this.btnNew.on('click',lang.hitch(this,function(){ 25 this._store.add({},function(obj) { 26 content.goTo('/survey',{uid:this.selectedObject.uid}); 22 Deferred.when( this._store.add({'creator':auth.getUser()}) ) 23 .then(function(obj) { 24 content.goTo('/survey',{uid:obj.getUid()}); 27 25 }); 28 26 })); … … 30 28 this.btnEdit.on('click',lang.hitch(this,function(){ 31 29 if ( this.selectedObject ) { 32 content.goTo('/survey',{uid:this.selectedObject. uid});30 content.goTo('/survey',{uid:this.selectedObject.getUid()}); 33 31 } 34 32
Note: See TracChangeset
for help on using the changeset viewer.