Ignore:
Timestamp:
10/16/13 16:05:39 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Changes for response submission & deletion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/pages/response.js

    r477 r478  
    6363            this.submitButton.set('disabled',false);
    6464            this.continueButton.set('disabled',false);
     65            this.cancelButton.set('disabled',false);
    6566            this.surveyWidget.set('disabled', false);
    6667        },
     
    6869            this.submitButton.set('disabled',true);
    6970            this.continueButton.set('disabled',true);
     71            this.cancelButton.set('disabled',true);
    7072            this.surveyWidget.set('disabled', true);
    7173        },
     
    8082                data:json.toJson(this.response),
    8183                headers:{"Content-Type": "application/json"}
    82             }).then(function(){
     84            }).then(lang.hitch(this,function(res){
     85                this.response._rev = res.rev;
    8386                Content.notify("Your response is saved.");
    84             }, function(err){
     87            }), function(err){
    8588                Content.notify(err,'error');
    8689            });
     
    104107            return false;
    105108        },
     109        _onCancel: function(e) {
     110            this._disableSubmit();
     111            this.surveyWidget.destroy();
     112            request('/api/responses/'+store.getIdentity(this.response)+'?rev='+store.getRevision(this.response),{
     113                method: 'DELETE',
     114                handleAs:'json',
     115                data:json.toJson(this.response),
     116                headers:{"Content-Type": "application/json"}
     117            }).then(lang.hitch(this,function(res){
     118                this._showInfo("<div>Your response has been deleted, no answers have been saved.</div>");
     119                Content.notify("Your response is deleted.");
     120            }), function(err){
     121                Content.notify(err,'error');
     122            });
     123            if ( e ) { event.stop(e); }
     124            return false;
     125        },
    106126        _ignoreEvent: function(e) {
    107127            if ( e ) { event.stop(e); }
Note: See TracChangeset for help on using the changeset viewer.