Changeset 490 for Dev/trunk/src/client/qed-client/pages/questions.js
- Timestamp:
- 03/08/14 22:51:23 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/pages/questions.js
r487 r490 1 1 define([ 2 "../app/Content",3 2 "../app/Page", 4 3 "../app/Router", … … 10 9 "dojo/_base/lang", 11 10 "dojo/text!./templates/questions.html" 12 ], function( Content,Page, Router, questions, TabbedQuestionBrowser, Deferred, declare, event, lang, template) {11 ], function(Page, Router, questions, TabbedQuestionBrowser, Deferred, declare, event, lang, template) { 13 12 return declare([Page],{ 14 13 templateString: template, … … 41 40 }, 42 41 onNewQuestion: function() { 43 Router.go( "/question/new");42 Router.go(questions.getObjectPath('new')); 44 43 }, 45 44 onDeleteQuestion: function(question) { 46 45 questions.remove(question) 47 .then( function(){48 Content.notify("Question deleted.");49 } ,function(err){50 Content.notify(err,'error');51 }) ;46 .then(lang.hitch(this,function(){ 47 this.notify("Question deleted."); 48 }),lang.hitch(this,function(err){ 49 this.notify(err.error,'error'); 50 })); 52 51 }, 53 52 onEditQuestion: function(question) { 54 Router.go( "/question/"+question._id);53 Router.go(questions.getObjectPath(question)); 55 54 }, 56 55 onPublishQuestion: function(question) { 57 56 question.publicationDate = new Date(); 58 57 questions.save(question) 59 .then( function(){60 Content.notify("Question published.");61 } ,function(err){62 Content.notify(err,'error');63 }) ;58 .then(lang.hitch(this,function(){ 59 this.notify("Question published."); 60 }),lang.hitch(this,function(err){ 61 this.notify(err.error,'error'); 62 })); 64 63 } 65 64 });
Note: See TracChangeset
for help on using the changeset viewer.