AC-171 Lastest changes for improving select and lookup workflow. Streamlined selection workflow with helpers/Selection.js. Restored the checkbox and fixed the hover background color on Lookup dialogs. Fixed bug in lookup dialog where most recent selection not showing up when user navigates back to same lookup multiple times. Both selection and lookup now work in an Angular fashion by manipulating the data set to affect view changes rather than attempting to manipulate the DOM within the controller.

This commit is contained in:
chouseknecht
2013-07-17 16:46:26 -04:00
parent bd693f226e
commit 49fd23d84d
12 changed files with 110 additions and 189 deletions

View File

@@ -12,7 +12,7 @@
function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, CredentialList,
GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
ClearScope, ProcessErrors, GetBasePath)
ClearScope, ProcessErrors, GetBasePath, SelectionInit)
{
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -24,16 +24,7 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
var scope = view.inject(list, { mode: mode }); // Inject our view
scope.selected = [];
if (scope.PostRefreshRemove) {
scope.PostRefreshRemove();
}
scope.PostRefreshRemove = scope.$on('PostRefresh', function() {
$("tr.success").each(function(index) {
// Make sure no rows have a green background
var ngc = $(this).attr('ng-class');
scope[ngc] = "";
});
});
SelectionInit({ scope: scope, list: list });
SearchInit({ scope: scope, set: 'credentials', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl });
@@ -125,28 +116,11 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
ReturnToCaller();
}
}
scope.toggle_credential = function(id) {
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
document.getElementById('check_' + id).checked = false;
if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(id),1);
}
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
document.getElementById('check_' + id).checked = true;
if (scope.selected.indexOf(id) == -1) {
scope.selected.push(id);
}
}
}
}
CredentialsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'CredentialList', 'GenerateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
'GetBasePath'];
'GetBasePath', 'SelectionInit'];
function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm,