Changeset 410 for Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
- Timestamp:
- 09/07/12 16:59:14 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r407 r410 4 4 'dojo/_base/event', 5 5 'dojo/_base/lang', 6 '../app/Controller',7 6 '../store', 7 '../app/Content', 8 '../app/Router', 8 9 '../app/Page', 9 10 '../ui/TabbedQuestionBrowser', 10 11 'dojo/text!./questions.html' 11 ],function(declare,Deferred,event,lang, Controller,store,Page,TabbedQuestionBrowser,template) {12 ],function(declare,Deferred,event,lang,store,Content,Router,Page,TabbedQuestionBrowser,template) { 12 13 return declare([Page],{ 13 14 templateString: template, … … 19 20 'class': 'blue', 20 21 itemActions: { 21 'Edit': {22 Edit: { 22 23 callback: lang.hitch(this,"onEditQuestion"), 23 icon: 'Edit', 24 description: 'Edit question' 24 icon: 'Edit', 25 description: 'Edit question' 26 }, 27 Publish: { 28 callback: lang.hitch(this,"onPublishQuestion"), 29 icon: 'Publish', 30 description: 'Publish question' 25 31 } 26 32 } 27 33 },this.questionBrowser); 28 34 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 35 }, 36 36 onNewQuestion: function() { … … 41 41 }, 42 42 onEditQuestion: function(question) { 43 Controller.go("/question/"+question._id); 43 Router.go("/question/"+question._id); 44 }, 45 onPublishQuestion: function(question) { 46 question.publicationDate = store.timestamp(); 47 store.put(question) 48 .then(function(){ 49 Content.notify("Question puplished."); 50 },function(err){ 51 Content.notify(err.reason,'error'); 52 }); 44 53 } 45 54 });
Note: See TracChangeset
for help on using the changeset viewer.