Changeset 420 for Dev/branches/rest-dojo-ui/client/qed/pages/surveys.js
- Timestamp:
- 12/16/12 20:07:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/qed/pages/surveys.js
r418 r420 9 9 '../app/Page', 10 10 '../app/Router', 11 '../model/classes/Survey', 12 '../model/classes/SurveyRun', 11 13 '../widgets/LineWithActionsWidget', 12 14 'dojo/text!./templates/surveys.html' 13 ],function(array,declare,lang,when,Rx,store,Content,Page,Router, LineWithActionsWidget,template){15 ],function(array,declare,lang,when,Rx,store,Content,Page,Router,Survey,SurveyRun,LineWithActionsWidget,template){ 14 16 return declare([Page],{ 15 17 templateString: template, … … 45 47 }, 46 48 _onPreviewSurvey:function(survey){ 47 Router.go('/ viewSurvey/'+store.getIdentity(survey),{preview:true});49 Router.go('/previewSurvey/'+store.getIdentity(survey)); 48 50 }, 49 51 _onRunSurvey:function(survey){ 50 this.surveyRun = { 51 type: 'SurveyRun', 52 surveyId: store.getIdentity(survey), 53 publicationDate: store.timestamp() 54 }; 55 this.surveyRunDialog.set('value',this.surveyRun); 56 this.surveyRunDialog.show(); 57 }, 58 _onSurveyRunOk: function() { 59 var surveyRun = lang.mixin(lang.clone(this.surveyRun),this.surveyRunDialog.get('value')); 52 var surveyRun = SurveyRun.create(); 53 SurveyRun.Survey.set(surveyRun,survey); 60 54 store.put(surveyRun) 61 .then(lang.hitch(this,function(){ 62 this.surveyRunDialog.hide(); 63 this.refreshRuns(); 55 .then(lang.hitch(this,function(surveyRun){ 56 this._onRunDetails(surveyRun); 64 57 }),function(err){ 65 58 Content.notify(err); 66 59 }); 67 60 }, 68 _on SurveyRunCancel: function() {69 this.surveyRunDialog.hide();61 _onRunDetails: function(surveyRun) { 62 Router.go('/surveyRun/'+store.getIdentity(surveyRun)); 70 63 }, 71 64 refresh: function() { … … 81 74 array.forEach(surveys,function(survey){ 82 75 var w = new LineWithActionsWidget({ 83 title: survey.title|| '(unnamed)',76 title: Survey.DisplayTitle.get(survey) || '(unnamed)', 84 77 actions: [{ 85 78 callback: lang.hitch(this,'_onPublishSurvey',survey), … … 123 116 array.forEach(surveys,function(survey){ 124 117 var w = new LineWithActionsWidget({ 125 title: survey.title,118 title: Survey.DisplayTitle.get(survey), 126 119 actions:[{ 127 120 callback: lang.hitch(this,'_onPreviewSurvey',survey), … … 151 144 array.forEach(surveyRuns,function(surveyRun){ 152 145 var w = new LineWithActionsWidget({ 153 title: surveyRun.title+" (from "+surveyRun.startDate+" to "+surveyRun.endDate+")",146 title: SurveyRun.DisplayTitle.get(surveyRun), 154 147 actions:[{ 155 callback: lang.hitch(this,'_on CloseRun',surveyRun),148 callback: lang.hitch(this,'_onRunDetails',surveyRun), 156 149 properties: { 157 label: ' Close',158 tooltip: ' Close survey',159 icon: ' Close'150 label: 'Details', 151 tooltip: 'Show details for this run', 152 icon: 'Details' 160 153 } 161 154 }]
Note: See TracChangeset
for help on using the changeset viewer.