Skip to content

Commit e41661f

Browse files
committed
1.2.1
1 parent d720703 commit e41661f

File tree

5 files changed

+35
-27
lines changed

5 files changed

+35
-27
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "restangular",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"main": "./dist/restangular.min.js",
55
"description": "Restful Resources service for AngularJS apps",
66
"repository": {

dist/restangular.js

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Restful Resources service for AngularJS apps
3-
* @version v1.2.0 - 2013-12-09
3+
* @version v1.2.1 - 2013-12-13
44
* @link https://github.com/mgonto/restangular
55
* @author Martin Gontovnikas <[email protected]>
66
* @license MIT License, http://www.opensource.org/licenses/MIT
@@ -29,12 +29,12 @@ module.provider('Restangular', function() {
2929
return _.isUndefined(config.absoluteUrl) || _.isNull(config.absoluteUrl) ?
3030
string && absolutePattern.test(string) :
3131
config.absoluteUrl;
32-
}
32+
};
3333

3434
config.absoluteUrl = _.isUndefined(config.absoluteUrl) ? false : true;
3535
object.setSelfLinkAbsoluteUrl = function(value) {
3636
config.absoluteUrl = value;
37-
}
37+
};
3838
/**
3939
* This is the BaseURL to be used with Restangular
4040
*/
@@ -71,7 +71,7 @@ module.provider('Restangular', function() {
7171
config.encodeIds = _.isUndefined(config.encodeIds) ? true : config.encodeIds;
7272
object.setEncodeIds = function(encode) {
7373
config.encodeIds = encode;
74-
}
74+
};
7575

7676
config.defaultRequestParams = config.defaultRequestParams || {
7777
get: {},
@@ -98,7 +98,7 @@ module.provider('Restangular', function() {
9898
config.defaultRequestParams[method] = params;
9999
});
100100
return this;
101-
}
101+
};
102102

103103
object.requestParams = config.defaultRequestParams;
104104

@@ -204,7 +204,7 @@ module.provider('Restangular', function() {
204204

205205
config.isRestangularized = function(obj) {
206206
return !!obj[config.restangularFields.one] || !!obj[config.restangularFields.all];
207-
}
207+
};
208208

209209
config.setFieldToElem = function(field, elem, value) {
210210
var properties = field.split('.');
@@ -238,23 +238,23 @@ module.provider('Restangular', function() {
238238
};
239239

240240
config.isValidId = function(elemId) {
241-
return "" !== elemId && !_.isUndefined(elemId) && !_.isNull(elemId)
242-
}
241+
return "" !== elemId && !_.isUndefined(elemId) && !_.isNull(elemId);
242+
};
243243

244244
config.setUrlToElem = function(elem, url) {
245245
config.setFieldToElem(config.restangularFields.selfLink, elem, url);
246246
return this;
247-
}
247+
};
248248

249249
config.getUrlFromElem = function(elem) {
250250
return config.getFieldFromElem(config.restangularFields.selfLink, elem);
251-
}
251+
};
252252

253253
config.useCannonicalId = _.isUndefined(config.useCannonicalId) ? false : config.useCannonicalId;
254254
object.setUseCannonicalId = function(value) {
255255
config.useCannonicalId = value;
256256
return this;
257-
}
257+
};
258258

259259
config.getCannonicalIdFromElem = function(elem) {
260260
var cannonicalId = elem[config.restangularFields.cannonicalId];
@@ -308,7 +308,7 @@ module.provider('Restangular', function() {
308308
params: params,
309309
element: interceptor(elem, operation, path, url),
310310
httpConfig: httpConfig
311-
}
311+
};
312312
};
313313
return this;
314314
};
@@ -327,7 +327,7 @@ module.provider('Restangular', function() {
327327

328328
config.onBeforeElemRestangularized = config.onBeforeElemRestangularized || function(elem) {
329329
return elem;
330-
}
330+
};
331331
object.setOnBeforeElemRestangularized = function(post) {
332332
config.onBeforeElemRestangularized = post;
333333
return this;
@@ -362,11 +362,11 @@ module.provider('Restangular', function() {
362362
if (_.isArray(values)) {
363363
config.shouldSaveParent = function(route) {
364364
return !_.contains(values, route);
365-
}
365+
};
366366
} else if (_.isBoolean(values)) {
367367
config.shouldSaveParent = function() {
368368
return !values;
369-
}
369+
};
370370
}
371371
return this;
372372
};
@@ -484,7 +484,7 @@ module.provider('Restangular', function() {
484484
return $http(_.extend(value, {
485485
url: url
486486
}));
487-
}
487+
};
488488

489489
} else {
490490

@@ -493,7 +493,7 @@ module.provider('Restangular', function() {
493493
url: url,
494494
data: data
495495
}));
496-
}
496+
};
497497

498498
}
499499
});
@@ -698,7 +698,7 @@ module.provider('Restangular', function() {
698698

699699
config.urlCreatorFactory.path = Path;
700700

701-
}
701+
};
702702

703703
var globalConfiguration = {};
704704

@@ -867,7 +867,7 @@ module.provider('Restangular', function() {
867867
} else {
868868
callFunction = function(operation, elem, path, params, headers) {
869869
return _.bind(customFunction, this)(operation, path, params, headers, elem);
870-
}
870+
};
871871
}
872872
elem[name] = _.bind(callFunction, elem, callOperation);
873873
});
@@ -888,13 +888,13 @@ module.provider('Restangular', function() {
888888
var localElem = restangularizeBase(parent, elem, route, reqParams);
889889

890890
if (config.useCannonicalId) {
891-
localElem[config.restangularFields.cannonicalId] = config.getIdFromElem(localElem)
891+
localElem[config.restangularFields.cannonicalId] = config.getIdFromElem(localElem);
892892
}
893893

894894
if (collection) {
895895
localElem[config.restangularFields.getParentList] = function() {
896896
return collection;
897-
}
897+
};
898898
}
899899

900900
localElem[config.restangularFields.restangularCollection] = false;
@@ -931,6 +931,14 @@ module.provider('Restangular', function() {
931931
return config.transformElem(localElem, true, route, service);
932932
}
933933

934+
function restangularizeCollectionAndElements(parent, element, route) {
935+
var collection = restangularizeCollection(parent, element, route);
936+
_.each(collection, function(elem) {
937+
restangularizeElem(parent, elem, route);
938+
});
939+
return collection;
940+
}
941+
934942
function getById(id, reqParams, headers){
935943
return this.customGET(id.toString(), reqParams, headers);
936944
}
@@ -1137,7 +1145,7 @@ module.provider('Restangular', function() {
11371145
} else {
11381146
this[name] = function(elem, params, headers) {
11391147
return createdFunction(params, headers, elem);
1140-
}
1148+
};
11411149
}
11421150

11431151
}
@@ -1170,7 +1178,7 @@ module.provider('Restangular', function() {
11701178

11711179
service.restangularizeElement = _.bind(restangularizeElem, service);
11721180

1173-
service.restangularizeCollection = _.bind(restangularizeCollection, service);
1181+
service.restangularizeCollection = _.bind(restangularizeCollectionAndElements, service);
11741182

11751183
return service;
11761184
}

0 commit comments

Comments
 (0)