Changeset 275 for Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
- Timestamp:
- 02/21/12 13:03:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r274 r275 1 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/_base/event', 2 2 'dojo/_base/Deferred','dojo/store/JsonRest','dijit/layout/ContentPane', 3 'rft/ui/_Page','rft/ui/ QuestionWidget'],4 function(declare,lang,array,event,Deferred,JsonRest,ContentPane,_Page, QuestionWidget) {3 'rft/ui/_Page','rft/ui/LineWithActionsWidget'], 4 function(declare,lang,array,event,Deferred,JsonRest,ContentPane,_Page,LineWithActionsWidget) { 5 5 return declare('rft.pages.questions',[_Page],{ 6 6 constructor: function() { … … 26 26 if ( !categoryContainer ) { 27 27 var ac = new ContentPane({ 28 title:category 28 title:category, 29 doLayout: false 29 30 }); 30 31 categoryContainer = this.containers[category] = { … … 40 41 var question = this.questions[uid]; 41 42 if ( !question ) { 42 var qw = new QuestionWidget({ 43 question: q 43 var qw = new LineWithActionsWidget({ 44 title: q.title, 45 userObject: q, 46 actions: { 47 'Edit': lang.hitch(this,'_editQuestion') 48 } 44 49 }); 45 50 qw.startup(); … … 48 53 widget: qw 49 54 } 55 } else { 56 // update info 57 question.question = q; 58 question.widget.title = q.title; 59 question.widget.userObject = q; 60 question.widget.refresh(); 50 61 } 51 62 var container = this._getContainerForQuestion(q); 52 63 question.widget.placeAt(container.containerNode); 53 container.resize();54 64 }, 55 65 onNewQuestion: function() { 56 66 Deferred.when( this._store.add({}) ) 57 67 .then(lang.hitch(this,function(question){ 58 this.questionForm.reset(); 59 this.questionForm.set('value',question); 60 this.questionDialog.show(); 68 this._editQuestion(question); 61 69 })); 70 }, 71 _editQuestion: function(question) { 72 this.questionForm.reset(); 73 this.questionForm.set('value',question); 74 this.questionDialog.show(); 62 75 }, 63 76 onSaveQuestion: function(evt) {
Note: See TracChangeset
for help on using the changeset viewer.