Changeset 490 for Dev/trunk/src/client/qed-client/model/classes
- Timestamp:
- 03/08/14 22:51:23 (11 years ago)
- Location:
- Dev/trunk/src/client/qed-client/model/classes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/model/classes/_Class.js
r487 r490 27 27 }, 28 28 load: function(id) { 29 return this._store.get(id).then(lang.hitch(this,'_doDeserialize')); 29 return this._store.get(id) 30 .then(lang.hitch(this,'_doDeserialize'), 31 lang.hitch(this,'_deserializeError')); 30 32 }, 31 33 save: function(obj) { 32 return this._store.put(this._doSerialize(obj)); 34 return this._store.put(this._doSerialize(obj)) 35 .otherwise(lang.hitch(this,'_deserializeError')); 33 36 }, 34 37 remove: function(objOrId,rev) { … … 40 43 rev = this.getRev(objOrId); 41 44 } 42 return this._store.remove(id,{headers:{'If-Match':'"'+rev+'"'}}); 45 return this._store.remove(id,{headers:{'If-Match':'"'+rev+'"'}}) 46 .otherwise(lang.hitch(this,'_deserializeError')); 43 47 }, 44 48 getRev: function(obj) { 45 49 return obj._rev; 50 }, 51 getName: function() { 52 return this._type; 53 }, 54 getObjectPath: function(idOrObj) { 55 return '/'+this._collection+'/'+(typeof idOrObj === "string" ? 56 idOrObj : 57 this.getId(idOrObj)); 46 58 } 47 59 }); -
Dev/trunk/src/client/qed-client/model/classes/_View.js
r487 r490 1 1 define([ 2 2 "../../store/JsonRest", 3 "dojo/Deferred", 3 4 "dojo/_base/declare", 5 "dojo/_base/json", 4 6 "dojo/_base/lang", 5 7 "dojo/store/util/QueryResults" 6 ], function(JsonRest, declare, lang, queryResults) {8 ], function(JsonRest, Deferred, declare, json, lang, queryResults) { 7 9 8 10 var _View = declare([],{ … … 18 20 }); 19 21 }, 22 _deserializeError: function(err) { 23 return new Deferred().reject(json.fromJson(err.responseText)); 24 }, 20 25 _doDeserialize: function(obj) { 21 26 obj = lang.clone(obj); … … 30 35 getId: function(obj) { 31 36 return obj._id; 37 }, 38 getCollectionPath: function() { 39 return '/'+this._collection; 32 40 } 33 41 }); -
Dev/trunk/src/client/qed-client/model/classes/responses.js
r487 r490 43 43 handleAs: 'json', 44 44 contentType: false 45 }).then(lang.hitch(this,'_doDeserialize'),function(err){ 46 return new Deferred().reject(json.fromJson(err.responseText)); 47 }); 45 }).then(lang.hitch(this,'_doDeserialize'), 46 lang.hitch(this,'_deserializeError')); 48 47 }, 49 48 postWithSecret: function(response,secret) { … … 55 54 contentType: 'application/json', 56 55 rawBody: body 57 }).then(lang.hitch(this,'_doDeserialize'),function(err){ 58 return new Deferred().reject(json.fromJson(err.responseText)); 59 }); 56 }).then(lang.hitch(this,'_doDeserialize'), 57 lang.hitch(this,'_deserializeError')); 60 58 }, 61 59 putWithSecret: function(response,secret) { … … 67 65 contentType: 'application/json', 68 66 rawBody: body 69 }).then(lang.hitch(this,'_doDeserialize'),function(err){ 70 return new Deferred().reject(json.fromJson(err.responseText)); 71 }); 67 }).then(lang.hitch(this,'_doDeserialize'), 68 lang.hitch(this,'_deserializeError')); 72 69 }, 73 70 removeWithSecret: function(response,secret) { … … 85 82 contentType: 'application/json', 86 83 rawBody: body 87 }) ;84 }).otherwise(lang.hitch(this,'_deserializeError')); 88 85 } 89 86 }); -
Dev/trunk/src/client/qed-client/model/classes/surveys.js
r487 r490 26 26 obj.publicationDate = stamp.toISOString(obj.publicationDate); 27 27 } 28 }, 29 getPreviewPath: function(idOrObj) { 30 return '/previewSurvey/'+(typeof idOrObj === "string"? 31 idOrObj : 32 this.getId(idOrObj)); 28 33 } 29 34 });
Note: See TracChangeset
for help on using the changeset viewer.