Changeset 478 for Dev/trunk/src/client


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

Changes for response submission & deletion.

Location:
Dev/trunk/src/client/qed-client
Files:
3 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); }
  • Dev/trunk/src/client/qed-client/pages/templates/response.html

    r463 r478  
    2929                data-dojo-attach-point="continueButton"
    3030                data-dojo-attach-event="onClick:_onContinueLater">
    31             Continue later</button>
     31            Save & Continue later</button>
     32        <button data-dojo-type="dijit/form/Button"
     33                type="button"
     34                data-dojo-attach-point="cancelButton"
     35                data-dojo-attach-event="onClick:_onCancel">
     36            Cancel & Delete</button>
    3237    </div>
    3338
  • Dev/trunk/src/client/qed-client/store.js

    r468 r478  
    1010   
    1111    var couchStore = new CouchStore({
    12         target: 'api/data/',
     12        target: '/data/',
    1313        request: request /*,
    1414        validate: function(object) {
Note: See TracChangeset for help on using the changeset viewer.