extjs-mvc 0.4.0.f → 0.4.0.g
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/bin/extjs-mvc +0 -3
- data/lib/extjs-mvc.rb +10 -6
- data/lib/extjs-mvc/api.rb +0 -1
- metadata +8 -84
- data/lib/src/App.js +0 -219
- data/lib/src/MVC.js +0 -260
- data/lib/src/Presenter.js +0 -52
- data/lib/src/README.rdoc +0 -69
- data/lib/src/controller/Controller.js +0 -278
- data/lib/src/controller/CrudController.js +0 -460
- data/lib/src/lib/Array.js +0 -26
- data/lib/src/lib/Booter.js +0 -416
- data/lib/src/lib/ClassManager.js +0 -191
- data/lib/src/lib/ControllerClassManager.js +0 -95
- data/lib/src/lib/Dependencies.js +0 -44
- data/lib/src/lib/DispatchMatcher.js +0 -98
- data/lib/src/lib/Dispatcher.js +0 -129
- data/lib/src/lib/Environment.js +0 -43
- data/lib/src/lib/Inflector.js +0 -155
- data/lib/src/lib/ModelClassManager.js +0 -19
- data/lib/src/lib/Route.js +0 -139
- data/lib/src/lib/Router.js +0 -282
- data/lib/src/lib/String.js +0 -94
- data/lib/src/lib/ViewClassManager.js +0 -229
- data/lib/src/lib/notes.txt +0 -32
- data/lib/src/model/AdapterManager.js +0 -30
- data/lib/src/model/Association.js +0 -26
- data/lib/src/model/Base.js +0 -63
- data/lib/src/model/BelongsToAssociation.js +0 -116
- data/lib/src/model/Cache.js +0 -131
- data/lib/src/model/HasManyAssociation.js +0 -160
- data/lib/src/model/Model.js +0 -331
- data/lib/src/model/UrlBuilder.js +0 -106
- data/lib/src/model/adapters/AbstractAdapter.js +0 -296
- data/lib/src/model/adapters/MemoryAdapter.js +0 -103
- data/lib/src/model/adapters/RESTAdapter.js +0 -345
- data/lib/src/model/adapters/RESTJSONAdapter.js +0 -68
- data/lib/src/model/adapters/notes.txt +0 -42
- data/lib/src/model/associations/Association.js +0 -192
- data/lib/src/model/associations/notes.txt +0 -87
- data/lib/src/model/validations/Errors.js +0 -136
- data/lib/src/model/validations/Plugin.js +0 -139
- data/lib/src/model/validations/Validations.js +0 -276
- data/lib/src/notes/Charts.graffle +0 -0
- data/lib/src/overrides/Ext.Component.js +0 -21
- data/lib/src/overrides/Ext.extend.js +0 -142
- data/lib/src/spec/Array.spec.js +0 -15
- data/lib/src/spec/ExtMVC.spec.js +0 -65
- data/lib/src/spec/Model.spec.js +0 -370
- data/lib/src/spec/OS.spec.js +0 -83
- data/lib/src/spec/Router.spec.js +0 -99
- data/lib/src/spec/SpecHelper.js +0 -106
- data/lib/src/spec/String.spec.js +0 -83
- data/lib/src/spec/model/AbstractAdapter.spec.js +0 -49
- data/lib/src/spec/model/Associations.spec.js +0 -99
- data/lib/src/spec/model/Cache.spec.js +0 -5
- data/lib/src/spec/model/RESTAdapter.spec.js +0 -19
- data/lib/src/spec/model/ValidationErrors.spec.js +0 -64
- data/lib/src/spec/model/Validations.spec.js +0 -166
- data/lib/src/spec/model/ValidationsPlugin.spec.js +0 -108
- data/lib/src/spec/suite.html +0 -60
- data/lib/src/specs-old/JSSpec.css +0 -216
- data/lib/src/specs-old/JSSpec.js +0 -1512
- data/lib/src/specs-old/all.html +0 -66
- data/lib/src/specs-old/base.js +0 -14
- data/lib/src/specs-old/controller.js +0 -17
- data/lib/src/specs-old/diff_match_patch.js +0 -1
- data/lib/src/specs-old/model.js +0 -70
- data/lib/src/specs-old/route.js +0 -38
- data/lib/src/specs-old/router.js +0 -59
- data/lib/src/specs-old/string.js +0 -22
- data/lib/src/testrunner/JSpecFormatter.js +0 -111
- data/lib/src/testrunner/TestClient.js +0 -181
- data/lib/src/testrunner/TestGrid.js +0 -351
- data/lib/src/testrunner/TestRunner.js +0 -110
- data/lib/src/testrunner/TestViewport.js +0 -94
- data/lib/src/vendor.yml +0 -29
- data/lib/src/vendor/ext-3.1.1/vendor.yml +0 -16
- data/lib/src/view/FormWindow.js +0 -184
- data/lib/src/view/HasManyEditorGridPanel.js +0 -211
- data/lib/src/view/scaffold/Edit.js +0 -46
- data/lib/src/view/scaffold/Index.js +0 -561
- data/lib/src/view/scaffold/New.js +0 -20
- data/lib/src/view/scaffold/ScaffoldFormPanel.js +0 -255
@@ -1,345 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @class ExtMVC.model.plugin.adapter.RESTAdapter
|
3
|
-
* @extends ExtMVC.model.plugin.adapter.Abstract
|
4
|
-
* An adapter which hooks into a RESTful server side API for its data storage. This is the recommended
|
5
|
-
* adapter to use on MVC applications.
|
6
|
-
* <h2>Usage</h2>
|
7
|
-
* Say we have a User model defined:
|
8
|
-
<pre><code>
|
9
|
-
ExtMVC.model.define("User", {
|
10
|
-
fields: [{name: 'id', type: 'int'}, {name: 'name', type: 'string'}]
|
11
|
-
});
|
12
|
-
var user = new User({id: 1, name: 'Saul Tigh'});
|
13
|
-
</code></pre>
|
14
|
-
* If this model uses the REST Adapter, the following methods are made available to it. Each fires the AJAX request
|
15
|
-
* indicated in the comment next to it:
|
16
|
-
<pre><code>
|
17
|
-
user.destroy(); //DELETE /users/1
|
18
|
-
user.save(); //PUT /users/1 with {id: 1, name: 'Saul Tigh'} as the request payload
|
19
|
-
user.update({name: 'Bill Adama'})l //PUT /users/1/ with {id: 1, name: 'Bill Adama'} as the request payload
|
20
|
-
</code></pre>
|
21
|
-
* In addition, the following methods are made available to the User class object:
|
22
|
-
<pre><code>
|
23
|
-
User.destroy(10); //DELETE /users/1
|
24
|
-
|
25
|
-
User.find(10, {
|
26
|
-
success: function(instance) {
|
27
|
-
console.log("Asyncronously loaded User 10 from /users/10 using GET")
|
28
|
-
},
|
29
|
-
failure: function() {
|
30
|
-
console.log('Called if user 10 could not be found');
|
31
|
-
}
|
32
|
-
}); //GET /users/10
|
33
|
-
|
34
|
-
User.create({name: 'Gaius Baltar'}, {
|
35
|
-
success: function(instance) {
|
36
|
-
console.log('Gaius was created');
|
37
|
-
},
|
38
|
-
failure: function(errors) {
|
39
|
-
console.log('Called if Gaius could not be created');
|
40
|
-
console.log(errors);
|
41
|
-
}
|
42
|
-
}); //POST /users
|
43
|
-
|
44
|
-
User.build({name: 'Felix Gaeta'}); //same as new User({name: 'Felix Gaeta'});
|
45
|
-
</code></pre>
|
46
|
-
*/
|
47
|
-
ExtMVC.model.plugin.adapter.RESTAdapter = Ext.extend(ExtMVC.model.plugin.adapter.Abstract, {
|
48
|
-
|
49
|
-
/**
|
50
|
-
* @property createMethod
|
51
|
-
* @type String
|
52
|
-
* The HTTP verb to use when creating a new instance (defaults to 'POST')
|
53
|
-
*/
|
54
|
-
createMethod: 'POST',
|
55
|
-
|
56
|
-
/**
|
57
|
-
* @property readMethod
|
58
|
-
* @type String
|
59
|
-
* The HTTP verb to use when reading data from the server (e.g. in find requests). Defaults to 'GET'
|
60
|
-
*/
|
61
|
-
readMethod: 'GET',
|
62
|
-
|
63
|
-
/**
|
64
|
-
* @property updateMethod
|
65
|
-
* @type String
|
66
|
-
* The HTTP verb to use when updating an existing instance (defaults to 'PUT')
|
67
|
-
*/
|
68
|
-
updateMethod: 'PUT',
|
69
|
-
|
70
|
-
/**
|
71
|
-
* @property destroyMethod
|
72
|
-
* @type String
|
73
|
-
* The HTTP verb to use when destroying an instance (defaults to 'DELETE')
|
74
|
-
*/
|
75
|
-
destroyMethod: 'DELETE',
|
76
|
-
|
77
|
-
/**
|
78
|
-
* @property proxyType
|
79
|
-
* @type Function
|
80
|
-
* The type of Data Proxy to use (defaults to Ext.data.HttpProxy)
|
81
|
-
*/
|
82
|
-
proxyType: Ext.data.HttpProxy,
|
83
|
-
|
84
|
-
/**
|
85
|
-
* Performs the actual save request. Uses POST for new records, PUT when updating existing ones
|
86
|
-
*/
|
87
|
-
doSave: function(instance, options) {
|
88
|
-
if (typeof instance == 'undefined') throw new Error('No instance provided to REST Adapter save');
|
89
|
-
options = options || {};
|
90
|
-
|
91
|
-
var successFn = options.success || Ext.emptyFn,
|
92
|
-
failureFn = options.failure || Ext.emptyFn;
|
93
|
-
|
94
|
-
delete options.success; delete options.failure;
|
95
|
-
|
96
|
-
Ext.Ajax.request(
|
97
|
-
Ext.apply({
|
98
|
-
url : this.instanceUrl(instance),
|
99
|
-
method : instance.newRecord() ? this.createMethod : this.updateMethod,
|
100
|
-
params : this.buildPostData(instance),
|
101
|
-
|
102
|
-
success: function(instance, userCallback, scope) {
|
103
|
-
var scope = scope || this;
|
104
|
-
|
105
|
-
return function(response, options) {
|
106
|
-
var jsonPath = instance.modelName.underscore(),
|
107
|
-
jsonData = Ext.decode(response.responseText)[jsonPath];
|
108
|
-
|
109
|
-
for (var key in jsonData) {
|
110
|
-
instance.set(key, jsonData[key]);
|
111
|
-
}
|
112
|
-
|
113
|
-
userCallback.call(scope, instance);
|
114
|
-
};
|
115
|
-
}(instance, successFn, options.scope),
|
116
|
-
|
117
|
-
failure: function(instance, userCallback, scope) {
|
118
|
-
var scope = options.scope || this;
|
119
|
-
|
120
|
-
return function(response, options) {
|
121
|
-
failureFn.call(scope, instance);
|
122
|
-
};
|
123
|
-
}(instance, failureFn, options.scope)
|
124
|
-
}, options)
|
125
|
-
);
|
126
|
-
},
|
127
|
-
|
128
|
-
/**
|
129
|
-
* Callback for save AJAX request. By default this reads server response data and populates the instance
|
130
|
-
* if the request was successful, adds errors if not
|
131
|
-
* @private
|
132
|
-
*/
|
133
|
-
afterSave: function() {
|
134
|
-
|
135
|
-
},
|
136
|
-
|
137
|
-
/**
|
138
|
-
* Performs the actual find request.
|
139
|
-
* @private
|
140
|
-
* @param {Object} conditions An object containing find conditions. If a primaryKey is set this will be used
|
141
|
-
* to build the url for that particular instance, otherwise the collection url will be used
|
142
|
-
* @param {Object} options Callbacks (use callback, success and failure)
|
143
|
-
*/
|
144
|
-
doFind: function(conditions, options, constructor) {
|
145
|
-
conditions = conditions || {}; options = options || {};
|
146
|
-
|
147
|
-
//if primary key is given, perform a single search
|
148
|
-
var single = (conditions.primaryKey !== undefined),
|
149
|
-
url = options.url || this.findUrl(conditions, constructor);
|
150
|
-
|
151
|
-
Ext.applyIf(options, {
|
152
|
-
conditions: conditions,
|
153
|
-
scope : this
|
154
|
-
});
|
155
|
-
|
156
|
-
var findMethod = single ? this.doSingleFind : this.doCollectionFind;
|
157
|
-
return findMethod.call(this, url, options, constructor);
|
158
|
-
},
|
159
|
-
|
160
|
-
/**
|
161
|
-
* Performs an HTTP DELETE request using Ext.Ajax.request
|
162
|
-
* @private
|
163
|
-
* @param {ExtMVC.model.Base} instance The model instance to destroy
|
164
|
-
* @param {Object} options Options object passed to Ext.Ajax.request
|
165
|
-
* @return {Number} The Ajax transaction ID
|
166
|
-
*/
|
167
|
-
doDestroy: function(instance, options, constructor) {
|
168
|
-
var options = options || {};
|
169
|
-
|
170
|
-
if (typeof instance == 'undefined') throw new Error('No instance provided to REST Adapter destroy');
|
171
|
-
|
172
|
-
if (!(instance instanceof Ext.data.Record)) {
|
173
|
-
var id = parseInt(instance, 10);
|
174
|
-
|
175
|
-
instance = new constructor();
|
176
|
-
instance.set(constructor.prototype.primaryKey, id);
|
177
|
-
}
|
178
|
-
|
179
|
-
//if we were passed a success function, save it here so that we can call it with the instance later
|
180
|
-
var successFn = options.success || Ext.emptyFn;
|
181
|
-
delete options.success;
|
182
|
-
|
183
|
-
return Ext.Ajax.request(
|
184
|
-
Ext.applyIf(options, {
|
185
|
-
method: this.destroyMethod,
|
186
|
-
url: this.instanceUrl(instance),
|
187
|
-
success: function() {
|
188
|
-
successFn.call(options.scope || this, instance);
|
189
|
-
}
|
190
|
-
})
|
191
|
-
);
|
192
|
-
},
|
193
|
-
|
194
|
-
/**
|
195
|
-
* Loads a single instance of a model via an Ext.Ajax.request
|
196
|
-
* @private
|
197
|
-
* @param {String} url The url to load from
|
198
|
-
* @param {Object} options Options passed to Ext.Ajax.request
|
199
|
-
* @param {Function} constructor The constructor function used to instantiate the model instance
|
200
|
-
* @return {Number} The transaction ID of the Ext.Ajax.request
|
201
|
-
*/
|
202
|
-
doSingleFind: function(url, options, constructor) {
|
203
|
-
//store references to user callbacks as we need to overwrite them in the request
|
204
|
-
var optionsCallback = options.callback,
|
205
|
-
successCallback = options.success,
|
206
|
-
failureCallback = options.failure;
|
207
|
-
|
208
|
-
delete options.callback; delete options.success; delete options.failure;
|
209
|
-
|
210
|
-
//need to make a local reference here as scope inside the Ext.data.Request block may not be 'this'
|
211
|
-
var decodeFunction = this.decodeSingleLoadResponse;
|
212
|
-
|
213
|
-
//helper function to cut down repetition in Ajax request callback
|
214
|
-
var callIf = function(callback, args) {
|
215
|
-
if (typeof callback == 'function') callback.apply(options.scope, args);
|
216
|
-
};
|
217
|
-
|
218
|
-
Ext.Ajax.request(
|
219
|
-
Ext.apply(options, {
|
220
|
-
callback: function(opts, success, response) {
|
221
|
-
if (success === true) {
|
222
|
-
var instance = new constructor(decodeFunction(response.responseText, constructor));
|
223
|
-
|
224
|
-
callIf(successCallback, [instance, opts, response]);
|
225
|
-
} else callIf(failureCallback, arguments);
|
226
|
-
|
227
|
-
//call the generic callback passed into options
|
228
|
-
callIf(optionsCallback, arguments);
|
229
|
-
}
|
230
|
-
}, this.buildProxyConfig(url))
|
231
|
-
);
|
232
|
-
},
|
233
|
-
|
234
|
-
/**
|
235
|
-
* @property storeConfig
|
236
|
-
* @type Object
|
237
|
-
* Default properties assigned to the Ext.data.Store used in find requests
|
238
|
-
*/
|
239
|
-
storeConfig: {
|
240
|
-
autoLoad : true,
|
241
|
-
remoteSort: false
|
242
|
-
},
|
243
|
-
|
244
|
-
/**
|
245
|
-
* Specialised find for dealing with collections. Returns an Ext.data.Store
|
246
|
-
* @private
|
247
|
-
* @param {String} url The url to load the collection from
|
248
|
-
* @param {Object} options Options passed to the Store constructor
|
249
|
-
* @param {Function} constructor The constructor function used to instantiate the model instance
|
250
|
-
* @return {Ext.data.Store} A Store with the appropriate configuration to load this collection
|
251
|
-
*/
|
252
|
-
doCollectionFind: function(url, options, constructor) {
|
253
|
-
Ext.applyIf(options, this.storeConfig);
|
254
|
-
|
255
|
-
if (options.conditions != undefined) {
|
256
|
-
Ext.applyIf(options, {
|
257
|
-
baseParams: options.conditions
|
258
|
-
});
|
259
|
-
}
|
260
|
-
|
261
|
-
return new Ext.data.Store(
|
262
|
-
Ext.applyIf(options, {
|
263
|
-
reader : constructor.prototype.getReader(),
|
264
|
-
proxy : new this.proxyType(this.buildProxyConfig(url))
|
265
|
-
})
|
266
|
-
);
|
267
|
-
},
|
268
|
-
|
269
|
-
/**
|
270
|
-
* Calculates the unique REST URL for a given model instance
|
271
|
-
* @param {ExtMVC.model.Base} instance The model instance
|
272
|
-
* @return {String} The url associated with this instance
|
273
|
-
*/
|
274
|
-
instanceUrl: function(instance) {
|
275
|
-
if (instance.newRecord()) {
|
276
|
-
return String.format("/{0}", instance.tableName);
|
277
|
-
} else {
|
278
|
-
return String.format("/{0}/{1}", instance.tableName, instance.get(instance.primaryKey));
|
279
|
-
}
|
280
|
-
},
|
281
|
-
|
282
|
-
/**
|
283
|
-
* Calculates the REST URL for a given model collection. By default this just returns / followed by the table name
|
284
|
-
* @param {Function} constructor The model constructor function
|
285
|
-
*/
|
286
|
-
collectionUrl: function(constructor) {
|
287
|
-
return String.format("/{0}", constructor.prototype.tableName);
|
288
|
-
},
|
289
|
-
|
290
|
-
/**
|
291
|
-
* Returns configuration data to be used by the DataProxy when loading records. Override to provide your own config
|
292
|
-
* @param {String} url The url the proxy should use. This is typically calculated elsewhere so must be provided
|
293
|
-
* @return {Object} Configuration for the proxy
|
294
|
-
*/
|
295
|
-
buildProxyConfig: function(url) {
|
296
|
-
return {
|
297
|
-
url: url,
|
298
|
-
method: this.readMethod
|
299
|
-
};
|
300
|
-
},
|
301
|
-
|
302
|
-
/**
|
303
|
-
* Creates a params object suitable for sending as POST data to the server
|
304
|
-
* @param {ExtMVC.model.Base} instance The models instance to build post data for
|
305
|
-
* @return {Object} Params object to send to the server
|
306
|
-
*/
|
307
|
-
buildPostData: function(instance) {
|
308
|
-
var data = {},
|
309
|
-
prefix = instance.modelName.underscore();
|
310
|
-
|
311
|
-
for (key in instance.data) {
|
312
|
-
data[prefix + '[' + key + ']'] = instance.data[key];
|
313
|
-
}
|
314
|
-
|
315
|
-
return data;
|
316
|
-
},
|
317
|
-
|
318
|
-
/**
|
319
|
-
* Decodes response text received from the server as the result of requesting data for a single record.
|
320
|
-
* By default this expects the data to be in the form {"model_name": {"key": "value", "key2", "value 2"}}
|
321
|
-
* and would return an object like {"key": "value", "key2", "value 2"}
|
322
|
-
* @param {String} responseText The raw response text
|
323
|
-
* @param {Function} constructor The constructor used to construct model instances. Useful for access to the prototype
|
324
|
-
* @return {Object} Decoded data suitable for use in a model constructor
|
325
|
-
*/
|
326
|
-
decodeSingleLoadResponse: function(responseText, constructor) {
|
327
|
-
var tname = constructor.prototype.tableName;
|
328
|
-
return Ext.decode(responseText)[tname];
|
329
|
-
},
|
330
|
-
|
331
|
-
//private
|
332
|
-
findUrl: function(conditions, constructor) {
|
333
|
-
if (typeof(conditions) == 'object' && conditions.primaryKey) {
|
334
|
-
//find by ID
|
335
|
-
var instance = new constructor({});
|
336
|
-
instance.set(instance.primaryKey, conditions.primaryKey);
|
337
|
-
delete conditions.primaryKey;
|
338
|
-
|
339
|
-
return this.instanceUrl(instance);
|
340
|
-
} else {
|
341
|
-
//find by conditions
|
342
|
-
return this.collectionUrl(constructor);
|
343
|
-
}
|
344
|
-
}
|
345
|
-
});
|
@@ -1,68 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @class ExtMVC.model.plugin.adapter.RESTJSONAdapter
|
3
|
-
* @extends ExtMVC.model.plugin.adapter.RESTAdapter
|
4
|
-
* An adapter which hooks into a RESTful server side API that expects JSON for its data storage
|
5
|
-
*/
|
6
|
-
ExtMVC.model.plugin.adapter.RESTJSONAdapter = Ext.extend(ExtMVC.model.plugin.adapter.RESTAdapter, {
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Performs the actual save request. Uses POST for new records, PUT when updating existing ones
|
10
|
-
* puts the data into jsonData for the request
|
11
|
-
*/
|
12
|
-
doSave: function(instance, options) {
|
13
|
-
if (typeof instance == 'undefined') throw new Error('No instance provided to REST Adapter save');
|
14
|
-
|
15
|
-
Ext.applyIf(options || {}, {
|
16
|
-
jsonData: instance.data,
|
17
|
-
params : {}, //ensures that params aren't appended to the end of the url
|
18
|
-
headers : {
|
19
|
-
"Content-Type": "application/json"
|
20
|
-
}
|
21
|
-
});
|
22
|
-
|
23
|
-
ExtMVC.model.plugin.adapter.RESTJSONAdapter.superclass.doSave.apply(this, arguments);
|
24
|
-
},
|
25
|
-
|
26
|
-
/**
|
27
|
-
* Performs the actual destroy request. This simply adds an 'application/json' content type to the headers
|
28
|
-
*/
|
29
|
-
doDestroy: function(instance, options, constructor) {
|
30
|
-
options = options || {};
|
31
|
-
|
32
|
-
Ext.applyIf(options, {
|
33
|
-
headers: {
|
34
|
-
"Content-Type": "application/json"
|
35
|
-
}
|
36
|
-
});
|
37
|
-
|
38
|
-
ExtMVC.model.plugin.adapter.RESTJSONAdapter.superclass.doDestroy.call(this, instance, options, constructor);
|
39
|
-
},
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Decodes response text received from the server as the result of requesting data for a single record.
|
43
|
-
* By default this expects the data to be in the form {"model_name": {"key": "value", "key2", "value 2"}}
|
44
|
-
* and would return an object like {"key": "value", "key2", "value 2"}
|
45
|
-
* @param {String} responseText The raw response text
|
46
|
-
* @param {Function} constructor The constructor used to construct model instances. Useful for access to the prototype
|
47
|
-
* @return {Object} Decoded data suitable for use in a model constructor
|
48
|
-
*/
|
49
|
-
decodeSingleLoadResponse: function(responseText, constructor) {
|
50
|
-
var tname = ExtMVC.Inflector.singularize(constructor.prototype.tableName);
|
51
|
-
return Ext.decode(responseText)[tname];
|
52
|
-
},
|
53
|
-
|
54
|
-
/**
|
55
|
-
* Returns configuration data to be used by the DataProxy when loading records. Override to provide your own config
|
56
|
-
* @param {String} url The url the proxy should use. This is typically calculated elsewhere
|
57
|
-
* @return {Object} Configuration for the proxy
|
58
|
-
*/
|
59
|
-
buildProxyConfig: function(url) {
|
60
|
-
var defaults = ExtMVC.model.plugin.adapter.RESTJSONAdapter.superclass.buildProxyConfig.apply(this, arguments);
|
61
|
-
|
62
|
-
return Ext.apply(defaults, {
|
63
|
-
headers: {
|
64
|
-
"Content-Type": "application/json"
|
65
|
-
}
|
66
|
-
});
|
67
|
-
}
|
68
|
-
});
|
@@ -1,42 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Method Collection Individual
|
3
|
-
* create yes yes (but different)
|
4
|
-
* build yes yes (might be different)
|
5
|
-
* find yes no
|
6
|
-
* loaded yes no
|
7
|
-
* count yes no
|
8
|
-
* destroy yes yes (but different)
|
9
|
-
*/
|
10
|
-
|
11
|
-
|
12
|
-
// ExtMVC.model.Adapter.Abstract = {
|
13
|
-
// initialize: function(model) {
|
14
|
-
//
|
15
|
-
// },
|
16
|
-
//
|
17
|
-
// classMethods: {
|
18
|
-
// find: function(options) {
|
19
|
-
//
|
20
|
-
// },
|
21
|
-
//
|
22
|
-
// findById: function(id, options) {
|
23
|
-
// return this.findByField('id', id, options);
|
24
|
-
// },
|
25
|
-
//
|
26
|
-
// findByField: function(fieldName, matcher, options) {
|
27
|
-
//
|
28
|
-
// },
|
29
|
-
//
|
30
|
-
// findAll: function(options) {
|
31
|
-
//
|
32
|
-
// }
|
33
|
-
// },
|
34
|
-
//
|
35
|
-
// instanceMethods: {
|
36
|
-
// save: Ext.emptyFn,
|
37
|
-
//
|
38
|
-
// reload: Ext.emptyFn,
|
39
|
-
//
|
40
|
-
// destroy: Ext.emptyFn
|
41
|
-
// }
|
42
|
-
// };
|