Skip to content

Commit 472d8c7

Browse files
committed
1.1.6
1 parent 1fea426 commit 472d8c7

21 files changed

+285
-38
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<a name="1.1.6"></a>
2+
### 1.1.6 (2015-01-06)
3+
4+
5+
#### Bug Fixes
6+
7+
* adds package.json to release task ([f7875766](http://github.com/angular-platanus/restmod/commit/f78757663c5b64136886f67069f7d694669607a1))
8+
* **factory:** fixes typo in call to canonicalUrlFor. ([5bfa439a](http://github.com/angular-platanus/restmod/commit/5bfa439a1cfe853d322403516ea70e12d51389fa), closes [#227](http://github.com/angular-platanus/restmod/issues/227))
9+
* **fastq:** adds missing 'catch' method to promises ([1fea426a](http://github.com/angular-platanus/restmod/commit/1fea426a1c6607ec3cc323d560f205a7e615be9f), closes [#183](http://github.com/angular-platanus/restmod/issues/183))
10+
11+
12+
#### Features
13+
14+
* **nesteddirty:** adds NestedDirtyModel plugin ([04b6178f](http://github.com/angular-platanus/restmod/commit/04b6178fcd99cd06e08845676313443f290c059e))
15+
* **plugin.nested_dirty:**
16+
* specifies how changing a nested object property to another type affects changed ([2a295779](http://github.com/angular-platanus/restmod/commit/2a295779d77e94300e7aea6a4072c638179fc888))
17+
* adds support for properties ([94bf9375](http://github.com/angular-platanus/restmod/commit/94bf937592136425bad514f618532af248a13936))
18+
* **service:** adds support for custom relation url name transformation. ([5a080925](http://github.com/angular-platanus/restmod/commit/5a08092513b8d1713b7431ea243ecc66564c238d), closes [#159](http://github.com/angular-platanus/restmod/issues/159))
19+
20+
121
<a name="1.1.5"></a>
222
### 1.1.5 (2014-12-10)
323

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-restmod",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"authors": [
55
"Ignacio Baixas <[email protected]>"
66
],

dist/angular-restmod-bundle.js

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* API Bound Models for AngularJS
3-
* @version v1.1.5 - 2014-12-10
3+
* @version v1.1.6 - 2015-01-06
44
* @link https://github.com/angular-platanus/restmod
55
* @author Ignacio Baixas <[email protected]>
66
* @license MIT License, http://www.opensource.org/licenses/MIT
@@ -687,8 +687,8 @@ RMModule.factory('RMCommonApi', ['$http', 'RMFastQ', '$log', function($http, $q,
687687
if(_for) {
688688
_for = '$' + _for + 'UrlFor';
689689
if(this.$scope[_for]) return this.$scope[_for](this);
690-
} else if(this.$scope.$cannonicalUrlFor) {
691-
return this.$scope.$cannonicalUrlFor(this);
690+
} else if(this.$scope.$canonicalUrlFor) {
691+
return this.$scope.$canonicalUrlFor(this);
692692
}
693693

694694
return this.$scope.$urlFor(this);
@@ -2394,7 +2394,7 @@ RMModule.factory('RMBuilderRelations', ['$injector', 'inflector', '$log', 'RMUti
23942394
}
23952395
}
23962396

2397-
var scope = this.$buildScope(_model, _url || inflector.parameterize(_attr)), col; // TODO: name to url transformation should be a Model strategy
2397+
var scope = this.$buildScope(_model, _url || _model.encodeUrlName(_attr)), col;
23982398

23992399
// setup collection
24002400
col = _model.$collection(_params || null, scope);
@@ -2459,7 +2459,7 @@ RMModule.factory('RMBuilderRelations', ['$injector', 'inflector', '$log', 'RMUti
24592459
}
24602460
}
24612461

2462-
var scope = this.$buildScope(_model, _url || inflector.parameterize(_attr)), inst;
2462+
var scope = this.$buildScope(_model, _url || _model.encodeUrlName(_attr)), inst;
24632463

24642464
// setup record
24652465
inst = _model.$new(null, scope);
@@ -2689,8 +2689,8 @@ RMModule.factory('RMBuilderRelations', ['$injector', 'inflector', '$log', 'RMUti
26892689
});
26902690

26912691
}]);
2692-
RMModule.factory('RMModelFactory', ['$injector', 'inflector', 'RMUtils', 'RMScopeApi', 'RMCommonApi', 'RMRecordApi', 'RMListApi', 'RMCollectionApi', 'RMExtendedApi', 'RMSerializer', 'RMBuilder',
2693-
function($injector, inflector, Utils, ScopeApi, CommonApi, RecordApi, ListApi, CollectionApi, ExtendedApi, Serializer, Builder) {
2692+
RMModule.factory('RMModelFactory', ['$injector', '$log', 'inflector', 'RMUtils', 'RMScopeApi', 'RMCommonApi', 'RMRecordApi', 'RMListApi', 'RMCollectionApi', 'RMExtendedApi', 'RMSerializer', 'RMBuilder',
2693+
function($injector, $log, inflector, Utils, ScopeApi, CommonApi, RecordApi, ListApi, CollectionApi, ExtendedApi, Serializer, Builder) {
26942694

26952695
var NAME_RGX = /(.*?)([^\/]+)\/?$/,
26962696
extend = Utils.extendOverriden;
@@ -3023,7 +3023,25 @@ RMModule.factory('RMModelFactory', ['$injector', 'inflector', 'RMUtils', 'RMScop
30233023
* @params {string} _name Record name
30243024
* @return {string} Response (raw) name
30253025
*/
3026-
encodeName: null
3026+
encodeName: null,
3027+
3028+
/**
3029+
* @memberof StaticApi#
3030+
*
3031+
* @description The model name to url encoding strategy
3032+
*
3033+
* This method is called when translating a name into an url fragment (mainly by relations).
3034+
*
3035+
* By default it uses the `inflector.parameterize` method, in 1.2 this will change and the default
3036+
* behaviour will be to do nothing.
3037+
*
3038+
* @params {string} _name local name
3039+
* @return {string} url fragment
3040+
*/
3041+
encodeUrlName: function(_name) {
3042+
$log.warn('Default paremeterization of urls will be disabled in 1.2, override Model.encodeUrlName with inflector.parameterize in your base model to keep the same behaviour.');
3043+
return inflector.parameterize(_name);
3044+
}
30273045

30283046
}, ScopeApi);
30293047

@@ -3302,7 +3320,10 @@ RMModule.factory('RMModelFactory', ['$injector', 'inflector', 'RMUtils', 'RMScop
33023320
*/
33033321
RMModule.factory('RMFastQ', [function() {
33043322

3305-
var isFunction = angular.isFunction;
3323+
var isFunction = angular.isFunction,
3324+
catchError = function(_error) {
3325+
return this.then(null, _error);
3326+
};
33063327

33073328
function simpleQ(_val, _withError) {
33083329

@@ -3314,6 +3335,7 @@ RMModule.factory('RMFastQ', [function() {
33143335
then: function(_success, _error) {
33153336
return simpleQ(_withError ? _error(_val) : _success(_val));
33163337
},
3338+
'catch': catchError,
33173339
'finally': function(_cb) {
33183340
var result = _cb();
33193341
if(result && isFunction(_val.then)) {
@@ -3347,6 +3369,7 @@ RMModule.factory('RMFastQ', [function() {
33473369
simple.then(_success, _error) :
33483370
wrappedQ(_promise.then(_success, _error));
33493371
},
3372+
'catch': catchError,
33503373
'finally': function(_cb) {
33513374
return simple ?
33523375
simple['finally'](_cb) :

dist/angular-restmod-bundle.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-restmod.js

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* API Bound Models for AngularJS
3-
* @version v1.1.5 - 2014-12-10
3+
* @version v1.1.6 - 2015-01-06
44
* @link https://github.com/angular-platanus/restmod
55
* @author Ignacio Baixas <[email protected]>
66
* @license MIT License, http://www.opensource.org/licenses/MIT
@@ -449,8 +449,8 @@ RMModule.factory('RMCommonApi', ['$http', 'RMFastQ', '$log', function($http, $q,
449449
if(_for) {
450450
_for = '$' + _for + 'UrlFor';
451451
if(this.$scope[_for]) return this.$scope[_for](this);
452-
} else if(this.$scope.$cannonicalUrlFor) {
453-
return this.$scope.$cannonicalUrlFor(this);
452+
} else if(this.$scope.$canonicalUrlFor) {
453+
return this.$scope.$canonicalUrlFor(this);
454454
}
455455

456456
return this.$scope.$urlFor(this);
@@ -2156,7 +2156,7 @@ RMModule.factory('RMBuilderRelations', ['$injector', 'inflector', '$log', 'RMUti
21562156
}
21572157
}
21582158

2159-
var scope = this.$buildScope(_model, _url || inflector.parameterize(_attr)), col; // TODO: name to url transformation should be a Model strategy
2159+
var scope = this.$buildScope(_model, _url || _model.encodeUrlName(_attr)), col;
21602160

21612161
// setup collection
21622162
col = _model.$collection(_params || null, scope);
@@ -2221,7 +2221,7 @@ RMModule.factory('RMBuilderRelations', ['$injector', 'inflector', '$log', 'RMUti
22212221
}
22222222
}
22232223

2224-
var scope = this.$buildScope(_model, _url || inflector.parameterize(_attr)), inst;
2224+
var scope = this.$buildScope(_model, _url || _model.encodeUrlName(_attr)), inst;
22252225

22262226
// setup record
22272227
inst = _model.$new(null, scope);
@@ -2451,8 +2451,8 @@ RMModule.factory('RMBuilderRelations', ['$injector', 'inflector', '$log', 'RMUti
24512451
});
24522452

24532453
}]);
2454-
RMModule.factory('RMModelFactory', ['$injector', 'inflector', 'RMUtils', 'RMScopeApi', 'RMCommonApi', 'RMRecordApi', 'RMListApi', 'RMCollectionApi', 'RMExtendedApi', 'RMSerializer', 'RMBuilder',
2455-
function($injector, inflector, Utils, ScopeApi, CommonApi, RecordApi, ListApi, CollectionApi, ExtendedApi, Serializer, Builder) {
2454+
RMModule.factory('RMModelFactory', ['$injector', '$log', 'inflector', 'RMUtils', 'RMScopeApi', 'RMCommonApi', 'RMRecordApi', 'RMListApi', 'RMCollectionApi', 'RMExtendedApi', 'RMSerializer', 'RMBuilder',
2455+
function($injector, $log, inflector, Utils, ScopeApi, CommonApi, RecordApi, ListApi, CollectionApi, ExtendedApi, Serializer, Builder) {
24562456

24572457
var NAME_RGX = /(.*?)([^\/]+)\/?$/,
24582458
extend = Utils.extendOverriden;
@@ -2785,7 +2785,25 @@ RMModule.factory('RMModelFactory', ['$injector', 'inflector', 'RMUtils', 'RMScop
27852785
* @params {string} _name Record name
27862786
* @return {string} Response (raw) name
27872787
*/
2788-
encodeName: null
2788+
encodeName: null,
2789+
2790+
/**
2791+
* @memberof StaticApi#
2792+
*
2793+
* @description The model name to url encoding strategy
2794+
*
2795+
* This method is called when translating a name into an url fragment (mainly by relations).
2796+
*
2797+
* By default it uses the `inflector.parameterize` method, in 1.2 this will change and the default
2798+
* behaviour will be to do nothing.
2799+
*
2800+
* @params {string} _name local name
2801+
* @return {string} url fragment
2802+
*/
2803+
encodeUrlName: function(_name) {
2804+
$log.warn('Default paremeterization of urls will be disabled in 1.2, override Model.encodeUrlName with inflector.parameterize in your base model to keep the same behaviour.');
2805+
return inflector.parameterize(_name);
2806+
}
27892807

27902808
}, ScopeApi);
27912809

@@ -3064,7 +3082,10 @@ RMModule.factory('RMModelFactory', ['$injector', 'inflector', 'RMUtils', 'RMScop
30643082
*/
30653083
RMModule.factory('RMFastQ', [function() {
30663084

3067-
var isFunction = angular.isFunction;
3085+
var isFunction = angular.isFunction,
3086+
catchError = function(_error) {
3087+
return this.then(null, _error);
3088+
};
30683089

30693090
function simpleQ(_val, _withError) {
30703091

@@ -3076,6 +3097,7 @@ RMModule.factory('RMFastQ', [function() {
30763097
then: function(_success, _error) {
30773098
return simpleQ(_withError ? _error(_val) : _success(_val));
30783099
},
3100+
'catch': catchError,
30793101
'finally': function(_cb) {
30803102
var result = _cb();
30813103
if(result && isFunction(_val.then)) {
@@ -3109,6 +3131,7 @@ RMModule.factory('RMFastQ', [function() {
31093131
simple.then(_success, _error) :
31103132
wrappedQ(_promise.then(_success, _error));
31113133
},
3134+
'catch': catchError,
31123135
'finally': function(_cb) {
31133136
return simple ?
31143137
simple['finally'](_cb) :

dist/angular-restmod.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugins/debounced.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* API Bound Models for AngularJS
3-
* @version v1.1.5 - 2014-12-10
3+
* @version v1.1.6 - 2015-01-06
44
* @link https://github.com/angular-platanus/restmod
55
* @author Ignacio Baixas <[email protected]>
66
* @license MIT License, http://www.opensource.org/licenses/MIT

dist/plugins/debounced.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/plugins/dirty.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* API Bound Models for AngularJS
3-
* @version v1.1.5 - 2014-12-10
3+
* @version v1.1.6 - 2015-01-06
44
* @link https://github.com/angular-platanus/restmod
55
* @author Ignacio Baixas <[email protected]>
66
* @license MIT License, http://www.opensource.org/licenses/MIT

dist/plugins/dirty.min.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* API Bound Models for AngularJS
3-
* @version v1.1.5 - 2014-12-10
3+
* @version v1.1.6 - 2015-01-06
44
* @link https://github.com/angular-platanus/restmod
55
* @author Ignacio Baixas <[email protected]>
66
* @license MIT License, http://www.opensource.org/licenses/MIT

0 commit comments

Comments
 (0)