Changeset 529 for Dev/trunk/src/client/qed-client/pages
- Timestamp:
- 03/23/14 22:58:54 (11 years ago)
- Location:
- Dev/trunk/src/client/qed-client/pages
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/pages/questions.js
r495 r529 50 50 }, 51 51 onDeleteQuestion: function(question) { 52 if ( !confirm("Are you sure you want to delete this question?") ) { 53 return; 54 } 52 55 questions.remove(question) 53 56 .then(lang.hitch(this,function(){ … … 62 65 }, 63 66 onPublishQuestion: function(question) { 67 if ( !confirm("After publication the question cannot be modified anymore, are you sure?") ) { 68 return; 69 } 64 70 question.publicationDate = new Date(); 65 71 questions.save(question) -
Dev/trunk/src/client/qed-client/pages/surveyRun.js
r519 r529 47 47 .then(lang.hitch(this,function(allResponses){ 48 48 array.forEach(allResponses, function(response){ 49 var actions = {} ;49 var actions = {}, w; 50 50 if ( !response.publicationDate ) { 51 51 actions.Delete = { 52 callback: function(){ 53 responses.remove(response) 54 .then(function(){ 55 w.destroy(); 56 }); 57 }, 52 callback: lang.hitch(this,function(){ 53 // We cannot bind _onDeleteResponse 54 // directly, because of the 55 // initialization problem with w. We 56 // need it in the handler, but we need 57 // to pass the handler as an argument 58 // on the creation of w. 59 this._onDeleteResponse(response,w); 60 }), 58 61 properties: { 59 62 icon: 'Delete', … … 62 65 }; 63 66 } 64 varw = new LineWithActionsWidget({67 w = new LineWithActionsWidget({ 65 68 actions: actions 66 69 }); … … 70 73 }, this); 71 74 })); 75 }, 76 _onDeleteResponse: function(response,w) { 77 if ( !confirm("Are you sure you want to delete this survey response?") ) { 78 return; 79 } 80 responses.remove(response) 81 .then(function(){ 82 w.destroy(); 83 }); 72 84 }, 73 85 _handlePropChange: function(e) { -
Dev/trunk/src/client/qed-client/pages/surveys.js
r508 r529 16 16 if ( this._started ) { return; } 17 17 this.inherited(arguments); 18 this.draftsTab.set('title','Drafts (<span class="qedLoading"></span>)'); 19 this.publishedTab.set('title','Published (<span class="qedLoading"></span>)'); 20 this.runsTab.set('title','Runs (<span class="qedLoading"></span>)'); 18 21 this.refresh(); 19 22 }, … … 22 25 }, 23 26 _onPublishSurvey:function(survey){ 24 var self = this; 27 if ( !confirm("After publication the survey cannot be modified anymore, are you sure?") ) { 28 return; 29 } 25 30 survey.publicationDate = new Date(); 26 31 surveys.save(survey) 27 .then( function(){28 self.refreshDrafts();29 self.refreshPublished();30 } ,lang.hitch(this,function(err){32 .then(lang.hitch(this,function(){ 33 this.refreshDrafts(); 34 this.refreshPublished(); 35 }),lang.hitch(this,function(err){ 31 36 this.notify(err.error,'error'); 32 37 })); 33 38 }, 34 39 _onDeleteSurvey:function(survey){ 35 var self = this; 40 if ( !confirm("Are you sure you want to delete this draft survey?") ) { 41 return; 42 } 36 43 surveys.remove(survey) 37 .then( function(){38 self.refreshDrafts();39 } ,lang.hitch(this,function(err){44 .then(lang.hitch(this,function(){ 45 this.refreshDrafts(); 46 }),lang.hitch(this,function(err){ 40 47 this.notify(err.error,'error'); 41 48 })); … … 62 69 }, 63 70 _onRunDelete: function(surveyRun) { 71 if ( !confirm("Are you sure you want to delete this survey run?") ) { 72 return; 73 } 64 74 surveyRuns.remove(surveyRun) 65 75 .then(lang.hitch(this,function(){ … … 135 145 label: 'Run', 136 146 tooltip: 'Run survey', 137 icon: ' Run'147 icon: 'Forward' 138 148 } 139 149 }] -
Dev/trunk/src/client/qed-client/pages/templates/surveys.html
r443 r529 8 8 </div> 9 9 10 <div data-dojo-attach-point="tabContainer" data-dojo-type="dijit/layout/TabContainer" class="blue" data-dojo-props="tabPosition:'left-h',region:'center'"> 10 <div data-dojo-attach-point="tabContainer" 11 data-dojo-type="dijit/layout/TabContainer" 12 class="blue" data-dojo-props="tabPosition:'left-h',region:'center'"> 11 13 12 <div data-dojo-type="dijit/layout/BorderContainer" title="Drafts" data-dojo-attach-point="draftsTab"> 14 <div data-dojo-type="dijit/layout/BorderContainer" 15 title="Drafts" 16 data-dojo-attach-point="draftsTab"> 13 17 <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'center'" data-dojo-attach-point="draftsContainer"> 14 18 </div> … … 17 21 </div> 18 22 19 <div data-dojo-type="dijit/layout/BorderContainer" title="Published" data-dojo-attach-point="publishedTab"> 20 <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'center'" data-dojo-attach-point="publishedContainer"> 23 <div data-dojo-type="dijit/layout/BorderContainer" 24 title="Published" 25 data-dojo-attach-point="publishedTab"> 26 <div data-dojo-type="dijit/layout/ContentPane" 27 data-dojo-props="region: 'center'" 28 data-dojo-attach-point="publishedContainer"> 21 29 </div> 22 <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'" style="height: 40px;"> 30 <div data-dojo-type="dijit/layout/ContentPane" 31 data-dojo-props="region: 'bottom'" 32 style="height: 40px;"> 23 33 </div> 24 34 </div> 25 35 26 <div data-dojo-type="dijit/layout/BorderContainer" title="Runs" data-dojo-attach-point="runsTab"> 27 <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'center'" data-dojo-attach-point="runsContainer"> 36 <div data-dojo-type="dijit/layout/BorderContainer" 37 title="Runs" 38 data-dojo-attach-point="runsTab"> 39 <div data-dojo-type="dijit/layout/ContentPane" 40 data-dojo-props="region: 'center'" 41 data-dojo-attach-point="runsContainer"> 28 42 </div> 29 <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'" style="height: 40px;"> 43 <div data-dojo-type="dijit/layout/ContentPane" 44 data-dojo-props="region: 'bottom'" 45 style="height: 40px;"> 30 46 </div> 31 47 </div> 32 48 </div> 33 49 34 <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'" style="height: 40px;"> 35 <button data-dojo-type="dijit/form/Button" class="blue" data-dojo-props="baseClass: 'rftBlockButton', iconClass: 'rftIcon rftIconNew'" data-dojo-attach-event="onClick:_onNewSurvey">New survey</button> 50 <div data-dojo-type="dijit/layout/ContentPane" 51 data-dojo-props="region: 'bottom'" 52 style="height: 40px;"> 53 <button data-dojo-type="dijit/form/Button" 54 class="blue" 55 data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconNew'" 56 data-dojo-attach-event="onClick:_onNewSurvey">New survey</button> 36 57 </div> 37 58
Note: See TracChangeset
for help on using the changeset viewer.