Changeset 366 for Dev/branches/rest-dojo-ui/client/rft/pages/question.js
- Timestamp:
- 07/18/12 18:49:11 (13 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/question.js
r363 r366 8 8 'rft/content', 9 9 'dijit/registry', 10 'dojo/on'], 11 function(declare, lang, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on){ 12 return declare('rft.pages.surveyAdvanced', [_Page], { 10 'dojo/on', 11 'dojo/behavior', 12 'dojo/query', 13 'rft/ui/QuestionEditorPreview', 14 'rft/ui/QuestionEditorToolkit', 15 'dijit/form/FilteringSelect'], 16 function(declare, lang, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on, behavior, query){ 17 return declare('rft.pages.question', [_Page], { 13 18 object: null, 19 preview: null, 20 14 21 onVisit: function() { 15 22 if (this.pageArgs.uid) { … … 23 30 24 31 this._setupButtons(); 32 this._setupEditor(); 25 33 }, 26 34 onLeave: function() { 27 35 this.inherited(arguments); 28 36 }, 29 _confirmSave: function() { 30 return confirm("Do you want to save?"); 37 _setupButtons: function() { 38 var behaviorMap = { 39 "#btnSave": { 40 onclick: lang.hitch(this, function(){ 41 this._saveSurvey(); 42 }) 43 }, 44 "#btnDiscard": { 45 onclick: lang.hitch(this, function(){ 46 this._restartEditor(); 47 }) 48 } 49 } 50 behavior.add(behaviorMap); 51 behavior.apply(); 31 52 }, 32 _saveSurvey: function() { 33 }, 34 _restartEditor: function() { 35 }, 36 _backToEditor: function() { 37 if (this._confirmSave()) { 38 this._saveSurvey() 39 content.goTo('survey', {uid: this.object._id}); 40 } else { 41 content.goTo('survey', {uid: this.object._id}); 42 } 43 }, 44 _setupButtons: function() { 45 registry.byId("btnSave").on("click", lang.hitch(this, function() { 46 this._saveSurvey(); 47 })); 48 registry.byId("btnDiscard").on("click", lang.hitch(this, function() { 49 this._restartEditor(); 50 })); 51 registry.byId("btnBack").on("click", lang.hitch(this, function() { 52 this._backToEditor(); 53 })); 53 _setupEditor: function() { 54 this.toolkit = new rft.ui.QuestionEditorToolkit(); 55 this.toolkit.placeAt("QuestionEditorToolkit"); 56 57 this.preview = new rft.ui.QuestionEditorPreview(); 58 this.preview.placeAt("QuestionEditorPreview"); 54 59 } 55 60 });
Note: See TracChangeset
for help on using the changeset viewer.