Changeset 407 for Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
- Timestamp:
- 09/05/12 14:41:13 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui
- Property svn:ignore
-
old new 1 1 nbproject 2 2 .project 3 release
-
- Property svn:ignore
-
Dev/branches/rest-dojo-ui/client
- Property svn:externals
-
old new 1 dojotoolkit http://svn.dojotoolkit.org/src/tags/release-1.8.0 1 dojo http://svn.dojotoolkit.org/src/tags/release-1.8.0/dojo 2 dijit http://svn.dojotoolkit.org/src/tags/release-1.8.0/dijit 3 dojox http://svn.dojotoolkit.org/src/tags/release-1.8.0/dojox 4 util http://svn.dojotoolkit.org/src/tags/release-1.8.0/util
-
- Property svn:externals
-
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r370 r407 4 4 'dojo/_base/event', 5 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) {11 return declare('rft.pages.questions',[_Page],{12 constructor: function(){13 this.inherited(arguments);14 },15 onVisit: function() {16 this.questionBrowser = new TabbedQuestionBrowser({17 region: 'center',18 'class': 'blue',19 itemActions: {20 'Edit': {21 callback: lang.hitch(this,"onEditQuestion"),22 icon: 'Edit',23 description: 'Edit question'24 }6 '../app/Controller', 7 '../store', 8 '../app/Page', 9 '../ui/TabbedQuestionBrowser', 10 'dojo/text!./questions.html' 11 ],function(declare,Deferred,event,lang,Controller,store,Page,TabbedQuestionBrowser,template) { 12 return declare([Page],{ 13 templateString: template, 14 startup: function() { 15 if ( this._started ) { return; } 16 this.inherited(arguments); 17 this.questionBrowser = new TabbedQuestionBrowser({ 18 region: 'center', 19 'class': 'blue', 20 itemActions: { 21 'Edit': { 22 callback: lang.hitch(this,"onEditQuestion"), 23 icon: 'Edit', 24 description: 'Edit question' 25 25 } 26 },this.questionBrowser); 27 this.questionBrowser.startup(); 28 }, 29 _refresh: function() { 30 Deferred.when(store.query('_design/default/_view/by_type',{key: 'Question'})) 31 .then(lang.hitch(this,function(items){ 32 this._list.setItems(items); 33 })); 34 }, 35 onNewQuestion: function() { 36 Deferred.when(store.add({type:'Question'})) 37 .then(lang.hitch(this,function(question){ 38 this.onEditQuestion(question); 39 })); 40 }, 41 onEditQuestion: function(question) { 42 content.goTo("question", {uid: question._id}); 43 } 44 }); 26 } 27 },this.questionBrowser); 28 this.questionBrowser.startup(); 29 }, 30 _refresh: function() { 31 Deferred.when(store.query('_design/default/_view/by_type',{key: 'Question'})) 32 .then(lang.hitch(this,function(items){ 33 this._list.setItems(items); 34 })); 35 }, 36 onNewQuestion: function() { 37 Deferred.when(store.add({type:'Question'})) 38 .then(lang.hitch(this,function(question){ 39 this.onEditQuestion(question); 40 })); 41 }, 42 onEditQuestion: function(question) { 43 Controller.go("/question/"+question._id); 44 } 45 }); 45 46 });
Note: See TracChangeset
for help on using the changeset viewer.