Team add/edit now working. Temporarily disabled organization name lookup on Team and Inventory lists. This will get fixed with AC-93 -add summary fields to response.

This commit is contained in:
chouseknecht
2013-05-08 16:26:21 -04:00
parent e5057fbd83
commit 51ef375183
7 changed files with 17 additions and 27 deletions

View File

@@ -24,7 +24,7 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale
var scope = view.inject(list, { mode: mode }); // Inject our view
scope.selected = [];
SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator });
//SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator });
SearchInit({ scope: scope, set: 'teams', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator);
@@ -199,7 +199,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
var defaultUrl='/api/v1/teams/';
var generator = GenerateForm;
var form = InventoryForm;
var form = TeamForm;
var scope = generator.inject(form, {mode: 'edit', related: true});
generator.reset();
var base = $location.path().replace(/^\//,'').split('/')[0];
@@ -209,7 +209,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
TeamLookUpOrganizationInit({ scope: scope });
// After inventory is loaded, retrieve each related set and any lookups
// Retrieve each related set and any lookups
scope.$on('teamLoaded', function() {
Rest.setUrl(scope['organization_url']);
Rest.get()
@@ -231,6 +231,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
Rest.get({ params: {id: id} })
.success( function(data, status, headers, config) {
LoadBreadCrumbs({ path: '/teams/' + id, title: data.name });
console.log(data);
for (var fld in form.fields) {
if (data[fld]) {
scope[fld] = data[fld];
@@ -243,7 +244,6 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
relatedSets[set] = { url: related[set], iterator: form.related[set].iterator };
}
}
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
@@ -265,7 +265,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
Rest.put(data)
.success( function(data, status, headers, config) {
var base = $location.path().replace(/^\//,'').split('/')[0];
(base == 'inventories') ? ReturnToCaller() : ReturnToCaller(1);
(base == 'teams') ? ReturnToCaller() : ReturnToCaller(1);
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,