Changeset 370 for Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
- Timestamp:
- 07/23/12 13:07:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r366 r370 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event', 2 'dojo/_base/Deferred','rft/store','rft/ui/_Page','rft/ui/AccordionList', 'rft/content'], 3 function(declare,lang,event,Deferred,store,_Page,AccordionList,content) { 1 define([ 2 'dojo/_base/declare', 3 'dojo/_base/Deferred', 4 'dojo/_base/event', 5 'dojo/_base/lang', 6 'rft/content', 7 'rft/store', 8 'rft/ui/_Page', 9 'rft/ui/TabbedQuestionBrowser' 10 ],function(declare,Deferred,event,lang,content,store,_Page,TabbedQuestionBrowser) { 4 11 return declare('rft.pages.questions',[_Page],{ 5 12 constructor: function() { 6 13 this.inherited(arguments); 7 this.questions = {};8 14 }, 9 15 onVisit: function() { 10 debugger; 11 this._list = new AccordionList({ 12 actions: { 16 this.questionBrowser = new TabbedQuestionBrowser({ 17 region: 'center', 18 'class': 'blue', 19 itemActions: { 13 20 'Edit': { 14 callback: lang.hitch(this,'_editQuestion'), 15 properties: { 16 blockButton: true, 17 icon: "Edit", 18 label: "Edit" 19 } 21 callback: lang.hitch(this,"onEditQuestion"), 22 icon: 'Edit', 23 description: 'Edit question' 20 24 } 21 22 23 }, 24 idProperty: store.idProperty, 25 categoryProperty: 'category', 26 titleProperty: 'title' 27 },this.list); 28 this._list.startup(); 29 this._refresh(); 25 } 26 },this.questionBrowser); 27 this.questionBrowser.startup(); 30 28 }, 31 29 _refresh: function() { … … 38 36 Deferred.when(store.add({type:'Question'})) 39 37 .then(lang.hitch(this,function(question){ 40 this. _editQuestion(question);38 this.onEditQuestion(question); 41 39 })); 42 40 }, 43 _editQuestion: function(question) {41 onEditQuestion: function(question) { 44 42 content.goTo("question", {uid: question._id}); 45 // this.questionForm.reset();46 // this.questionWidget.set('value',question);47 // this.questionDialog.show();48 },49 onSaveQuestion: function(evt) {50 var value = this.questionWidget.get('value');51 Deferred.when(store.put(value))52 .then(lang.hitch(this,function(){53 this.questionDialog.hide();54 this.questionForm.reset();55 this._refresh();56 }));57 event.stop(evt);58 return false;59 },60 onCancelQuestion: function() {61 this.questionDialog.hide();62 this.questionForm.reset();63 43 } 64 44 });
Note: See TracChangeset
for help on using the changeset viewer.