Skip to content

Commit 70aaace

Browse files
committed
chore(deps) Update to Angular 1.6.1
1 parent de9a64a commit 70aaace

19 files changed

+140
-122
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ server/**/*.js
2323
server/**/*.map
2424
Phantom*/**/*
2525

26+
tscArguments
2627
test_out/*
2728
PhantomJS_1.9.8_(Linux_0.0.0)/test_out/unit.xml
2829
PhantomJS_1.9.8_(Mac_OS_X_0.0.0)/test_out/unit.xml

bower.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "forms-angular",
33
"author": "Mark Chapman <support@forms-angular.org>",
4-
"version": "0.7.1",
4+
"version": "0.7.2",
55
"homepage": "https://github.com/forms-angular/forms-angular",
66
"description": "No nonsense forms for the MEAN stack",
77
"keywords": [
@@ -18,16 +18,16 @@
1818
"dist/forms-angular.js"
1919
],
2020
"dependencies": {
21-
"angular": "1.5.5",
22-
"angular-sanitize": "1.5.5",
23-
"angular-messages": "1.5.5",
21+
"angular": "1.6.1",
22+
"angular-sanitize": "1.6.1",
23+
"angular-messages": "1.6.1",
2424
"angular-ui-bootstrap-bower": "1.3.2",
2525
"underscore": "1.8.3",
26-
"ngInfiniteScroll": "1.2.1",
26+
"ngInfiniteScroll": "1.3.4",
2727
"angular-elastic": "2.5.1"
2828
},
2929
"devDependencies": {
30-
"angular-mocks": "1.5.5",
30+
"angular-mocks": "1.6.1",
3131
"bootstrap-3-3-5": "git://github.com/twbs/bootstrap.git#v3.3.5",
3232
"bootstrap-2-3-2": "git://github.com/twbs/bootstrap.git#v2.3.2"
3333
},

dist/forms-angular-with-bs2.css

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/forms-angular-with-bs3.css

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/forms-angular.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference path="../typings/globals/angular/index.d.ts" />
22
/// <reference path="../typings/globals/underscore/index.d.ts" />
3+
/// <reference path="../typings/globals/jquery/index.d.ts" />
34
declare module fng {
45
interface IFieldViewInfo {
56
name: string;
@@ -20,7 +21,7 @@ declare module fng {
2021
updateDocument(dataToSave: any, options: any, scope: fng.IFormScope, ctrlState: any): void;
2122
readRecord($scope: fng.IFormScope, ctrlState: any): any;
2223
scrollTheList($scope: fng.IFormScope): any;
23-
getListData(record: any, fieldName: any, select2List: any): any;
24+
getListData(record: any, fieldName: any, select2List: any, listSchema: any): any;
2425
suffixCleanId(inst: any, suffix: any): any;
2526
setData(object: any, fieldname: any, element: any, value: any): any;
2627
setUpSelectOptions(lookupCollection: any, schemaElement: any, $scope: fng.IFormScope, ctrlState: any, handleSchema: any): any;
@@ -93,7 +94,7 @@ declare module fng {
9394
scrollTheList: any;
9495
getListData: any;
9596
dismissError: any;
96-
handleHttpError(data: any, status: number): void;
97+
handleHttpError(response: any): void;
9798
}
9899
interface IBaseFormOptions {
99100
/**

dist/forms-angular.js

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ var fng;
6060
ModelCtrl.$inject = ["$scope", "$http", "$location", "routingService"];
6161
function ModelCtrl($scope, $http, $location, routingService) {
6262
$scope.models = [];
63-
$http.get('/api/models').success(function (data) {
64-
$scope.models = data;
65-
}).error(function () {
63+
$http.get('/api/models').then(function (response) {
64+
$scope.models = response.data;
65+
}, function () {
6666
$location.path('/404');
6767
});
6868
$scope.newUrl = function (model) {
@@ -369,7 +369,8 @@ var fng;
369369
$scope.$watch('searchTarget', function (newValue) {
370370
if (newValue && newValue.length > 0) {
371371
currentRequest = newValue;
372-
$http.get('/api/search?q=' + newValue).success(function (data) {
372+
$http.get('/api/search?q=' + newValue).then(function (response) {
373+
var data = response.data;
373374
// Check that we haven't fired off a subsequent request, in which
374375
// case we are no longer interested in these results
375376
if (currentRequest === newValue) {
@@ -386,8 +387,8 @@ var fng;
386387
clearSearchResults();
387388
}
388389
}
389-
}).error(function (data, status) {
390-
console.log('Error in searchbox.js : ' + data + ' (status=' + status + ')');
390+
}, function (response) {
391+
console.log('Error in searchbox.js : ' + response.data + ' (status=' + response.status + ')');
391392
});
392393
}
393394
else {
@@ -476,15 +477,16 @@ var fng;
476477
}
477478
scope['link'] = routingService.buildUrl(ref + '/' + form + newVal + '/edit');
478479
if (!scope['text']) {
479-
SubmissionsService.getListAttributes(ref, newVal).success(function (data) {
480+
SubmissionsService.getListAttributes(ref, newVal).then(function (response) {
481+
var data = response.data;
480482
if (data.success === false) {
481483
scope['text'] = data.err;
482484
}
483485
else {
484486
scope['text'] = data.list;
485487
}
486-
}).error(function (status, err) {
487-
scope['text'] = 'Error ' + status + ': ' + err;
488+
}, function (response) {
489+
scope['text'] = 'Error ' + response.status + ': ' + response.data;
488490
});
489491
}
490492
}
@@ -1563,6 +1565,9 @@ var fng;
15631565
if (config.hashPrefix !== '') {
15641566
$locationProvider.hashPrefix(config.hashPrefix);
15651567
}
1568+
else if (!config.html5Mode) {
1569+
$locationProvider.hashPrefix('');
1570+
}
15661571
switch (config.routing) {
15671572
case 'ngroute':
15681573
_routeProvider = $injector.get('$routeProvider');
@@ -1732,6 +1737,7 @@ var fng;
17321737
services.routingService = routingService;
17331738
})(services = fng.services || (fng.services = {}));
17341739
})(fng || (fng = {}));
1740+
/// <reference path="../../typings/globals/jquery/index.d.ts" />
17351741
/// <reference path="../../typings/globals/angular/index.d.ts" />
17361742
/// <reference path="../../typings/globals/underscore/index.d.ts" />
17371743
/// <reference path="../fng-types.ts" />
@@ -1992,15 +1998,16 @@ var fng;
19921998
var theId = element.val();
19931999
if (theId && theId !== '') {
19942000
SubmissionsService.getListAttributes(mongooseOptions.ref, theId)
1995-
.success(function (data) {
2001+
.then(function (response) {
2002+
var data = response.data;
19962003
if (data.success === false) {
19972004
$location.path('/404');
19982005
}
19992006
var display = { id: theId, text: data.list };
20002007
recordHandler.preservePristine(element, function () {
20012008
callback(display);
20022009
});
2003-
}).error($scope.handleHttpError);
2010+
}, $scope.handleHttpError);
20042011
}
20052012
},
20062013
ajax: {
@@ -3200,41 +3207,42 @@ var fng;
32003207
}
32013208
}
32023209
function handleError($scope) {
3203-
return function (data, status) {
3204-
if ([200, 400].indexOf(status) !== -1) {
3210+
return function (response) {
3211+
if ([200, 400].indexOf(response.status) !== -1) {
32053212
var errorMessage = '';
3206-
for (var errorField in data.errors) {
3207-
if (data.errors.hasOwnProperty(errorField)) {
3213+
for (var errorField in response.data.errors) {
3214+
if (response.data.errors.hasOwnProperty(errorField)) {
32083215
errorMessage += '<li><b>' + $filter('titleCase')(errorField) + ': </b> ';
3209-
switch (data.errors[errorField].type) {
3216+
switch (response.data.errors[errorField].type) {
32103217
case 'enum':
32113218
errorMessage += 'You need to select from the list of values';
32123219
break;
32133220
default:
3214-
errorMessage += data.errors[errorField].message;
3221+
errorMessage += response.data.errors[errorField].message;
32153222
break;
32163223
}
32173224
errorMessage += '</li>';
32183225
}
32193226
}
32203227
if (errorMessage.length > 0) {
3221-
errorMessage = data.message + '<br /><ul>' + errorMessage + '</ul>';
3228+
errorMessage = response.data.message + '<br /><ul>' + errorMessage + '</ul>';
32223229
}
32233230
else {
3224-
errorMessage = data.message || 'Error! Sorry - No further details available.';
3231+
errorMessage = response.data.message || 'Error! Sorry - No further details available.';
32253232
}
32263233
$scope.showError(errorMessage);
32273234
}
32283235
else {
3229-
$scope.showError(status + ' ' + JSON.stringify(data));
3236+
$scope.showError(response.status + ' ' + JSON.stringify(response.data));
32303237
}
32313238
};
32323239
}
32333240
return {
32343241
readRecord: function readRecord($scope, ctrlState) {
32353242
// TODO Consider using $parse for this - http://bahmutov.calepin.co/angularjs-parse-hacks.html
32363243
SubmissionsService.readRecord($scope.modelName, $scope.id)
3237-
.success(function (data) {
3244+
.then(function (response) {
3245+
var data = response.data;
32383246
if (data.success === false) {
32393247
$location.path('/404');
32403248
}
@@ -3244,7 +3252,7 @@ var fng;
32443252
$scope.dataEventFunctions.onAfterRead(data);
32453253
}
32463254
processServerData(data, $scope, ctrlState);
3247-
}).error($scope.handleHttpError);
3255+
}, $scope.handleHttpError);
32483256
},
32493257
scrollTheList: function scrollTheList($scope) {
32503258
var pagesLoaded = $scope.pagesLoaded;
@@ -3255,7 +3263,8 @@ var fng;
32553263
skip: pagesLoaded * $scope.pageSize,
32563264
order: $location.$$search.o
32573265
})
3258-
.success(function (data) {
3266+
.then(function (response) {
3267+
var data = response.data;
32593268
if (angular.isArray(data)) {
32603269
// I have seen an intermittent problem where a page is requested twice
32613270
if (pagesLoaded === $scope.pagesLoaded) {
@@ -3269,13 +3278,12 @@ var fng;
32693278
else {
32703279
$scope.showError(data, 'Invalid query');
32713280
}
3272-
})
3273-
.error($scope.handleHttpError);
3281+
}, $scope.handleHttpError);
32743282
},
32753283
// TODO: Do we need model here? Can we not infer it from scope?
32763284
deleteRecord: function deleteRecord(model, id, $scope, ctrlState) {
32773285
SubmissionsService.deleteRecord(model, id)
3278-
.success(function () {
3286+
.then(function () {
32793287
if (typeof $scope.dataEventFunctions.onAfterDelete === 'function') {
32803288
$scope.dataEventFunctions.onAfterDelete(ctrlState.master);
32813289
}
@@ -3285,7 +3293,8 @@ var fng;
32853293
updateDocument: function updateDocument(dataToSave, options, $scope, ctrlState) {
32863294
$scope.phase = 'updating';
32873295
SubmissionsService.updateRecord($scope.modelName, $scope.id, dataToSave)
3288-
.success(function (data) {
3296+
.then(function (response) {
3297+
var data = response.data;
32893298
if (data.success !== false) {
32903299
if (typeof $scope.dataEventFunctions.onAfterUpdate === 'function') {
32913300
$scope.dataEventFunctions.onAfterUpdate(data, ctrlState.master);
@@ -3304,12 +3313,12 @@ var fng;
33043313
else {
33053314
$scope.showError(data);
33063315
}
3307-
})
3308-
.error($scope.handleHttpError);
3316+
}, $scope.handleHttpError);
33093317
},
33103318
createNew: function createNew(dataToSave, options, $scope) {
33113319
SubmissionsService.createRecord($scope.modelName, dataToSave)
3312-
.success(function (data) {
3320+
.then(function (response) {
3321+
var data = response.data;
33133322
if (data.success !== false) {
33143323
if (typeof $scope.dataEventFunctions.onAfterCreate === 'function') {
33153324
$scope.dataEventFunctions.onAfterCreate(data);
@@ -3324,8 +3333,7 @@ var fng;
33243333
else {
33253334
$scope.showError(data);
33263335
}
3327-
})
3328-
.error($scope.handleHttpError);
3336+
}, $scope.handleHttpError);
33293337
},
33303338
getListData: getListData,
33313339
suffixCleanId: suffixCleanId,
@@ -3334,7 +3342,8 @@ var fng;
33343342
var optionsList = $scope[schemaElement.options] = [];
33353343
var idList = $scope[schemaElement.ids] = [];
33363344
SchemasService.getSchema(lookupCollection)
3337-
.success(function (data) {
3345+
.then(function (response) {
3346+
var data = response.data;
33383347
var listInstructions = [];
33393348
handleSchema('Lookup ' + lookupCollection, data, null, listInstructions, '', false, $scope, ctrlState);
33403349
var dataRequest;
@@ -3346,7 +3355,8 @@ var fng;
33463355
dataRequest = SubmissionsService.getAll(lookupCollection);
33473356
}
33483357
dataRequest
3349-
.success(function (data) {
3358+
.then(function (response) {
3359+
var data = response.data;
33503360
if (data) {
33513361
for (var i = 0; i < data.length; i++) {
33523362
var option = '';
@@ -3608,10 +3618,10 @@ var fng;
36083618
fillFormFromBackendCustomSchema: fillFormFromBackendCustomSchema,
36093619
fillFormWithBackendSchema: function fillFormWithBackendSchema($scope, formGeneratorInstance, recordHandlerInstance, ctrlState) {
36103620
SchemasService.getSchema($scope.modelName, $scope.formName)
3611-
.success(function (schema) {
3621+
.then(function (response) {
3622+
var schema = response.data;
36123623
fillFormFromBackendCustomSchema(schema, $scope, formGeneratorInstance, recordHandlerInstance, ctrlState);
3613-
})
3614-
.error($scope.handleHttpError);
3624+
}, $scope.handleHttpError);
36153625
}
36163626
};
36173627
}

dist/forms-angular.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.

js/controllers/model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ module fng.controllers {
66
export function ModelCtrl($scope, $http, $location, routingService) {
77

88
$scope.models = [];
9-
$http.get('/api/models').success(function (data) {
10-
$scope.models = data;
11-
}).error(function () {
9+
$http.get('/api/models').then(function (response) {
10+
$scope.models = response.data;
11+
}, function () {
1212
$location.path('/404');
1313
});
1414

js/controllers/search-ctrl.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ module fng.controllers {
9090
$scope.$watch('searchTarget', function (newValue) {
9191
if (newValue && newValue.length > 0) {
9292
currentRequest = newValue;
93-
$http.get('/api/search?q=' + newValue).success(function (data) {
93+
$http.get('/api/search?q=' + newValue).then(function (response) {
94+
let data: any = response.data;
9495
// Check that we haven't fired off a subsequent request, in which
9596
// case we are no longer interested in these results
9697
if (currentRequest === newValue) {
@@ -106,8 +107,8 @@ module fng.controllers {
106107
clearSearchResults();
107108
}
108109
}
109-
}).error(function (data, status) {
110-
console.log('Error in searchbox.js : ' + data + ' (status=' + status + ')');
110+
}, function (response) {
111+
console.log('Error in searchbox.js : ' + response.data + ' (status=' + response.status + ')');
111112
});
112113
} else {
113114
clearSearchResults();

js/directives/fng-link.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ module fng.directives {
2323
}
2424
scope['link'] = routingService.buildUrl(ref + '/' + form + newVal + '/edit');
2525
if (!scope['text']) {
26-
SubmissionsService.getListAttributes(ref, newVal).success(function (data) {
26+
SubmissionsService.getListAttributes(ref, newVal).then(function (response) {
27+
let data: any = response.data;
2728
if (data.success === false) {
2829
scope['text'] = data.err;
2930
} else {
3031
scope['text'] = data.list;
3132
}
32-
}).error(function (status, err) {
33-
scope['text'] = 'Error ' + status + ': ' + err;
33+
}, function (response) {
34+
scope['text'] = 'Error ' + response.status + ': ' + response.data;
3435
});
3536
}
3637
}

js/fng-types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module fng {
2323
updateDocument(dataToSave : any, options: any, scope: fng.IFormScope, ctrlState: any) : void;
2424
readRecord($scope: fng.IFormScope, ctrlState);
2525
scrollTheList($scope: fng.IFormScope);
26-
getListData(record, fieldName, select2List);
26+
getListData(record, fieldName, select2List, listSchema);
2727
suffixCleanId(inst, suffix);
2828
setData(object, fieldname, element, value);
2929
setUpSelectOptions(lookupCollection, schemaElement, $scope: fng.IFormScope, ctrlState, handleSchema);
@@ -104,7 +104,7 @@ module fng {
104104
scrollTheList: any;
105105
getListData: any;
106106
dismissError: any;
107-
handleHttpError(data: any, status: number): void;
107+
handleHttpError(response: any): void;
108108
}
109109

110110
export interface IBaseFormOptions {

js/services/fng-routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ module fng.services {
103103
$locationProvider.html5Mode(config.html5Mode);
104104
if (config.hashPrefix !== '') {
105105
$locationProvider.hashPrefix(config.hashPrefix);
106+
} else if (!config.html5Mode) {
107+
$locationProvider.hashPrefix('');
106108
}
107109
switch (config.routing) {
108110
case 'ngroute' :

0 commit comments

Comments
 (0)