Applied change to all list controllers to remove success class after page refresh. If the list was previously used to make a selection, there won't be any remnants or reminders of the selection next time the list is visited.

This commit is contained in:
chouseknecht
2013-06-05 16:13:25 -04:00
parent 135d4db94b
commit 5a22f3b955
12 changed files with 91 additions and 4 deletions

View File

@@ -21,6 +21,17 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
var scope = view.inject(AdminList, { mode: mode }); // Inject our view var scope = view.inject(AdminList, { mode: mode }); // Inject our view
scope.selected = []; 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] = "";
});
});
SearchInit({ scope: scope, set: 'admins', list: list, url: defaultUrl }); SearchInit({ scope: scope, set: 'admins', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator); scope.search(list.iterator);

View File

@@ -24,6 +24,17 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
var scope = view.inject(CredentialList, { mode: mode }); // Inject our view var scope = view.inject(CredentialList, { mode: mode }); // Inject our view
scope.selected = []; 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] = "";
});
});
SearchInit({ scope: scope, set: 'credentials', list: list, url: defaultUrl }); SearchInit({ scope: scope, set: 'credentials', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator); scope.search(list.iterator);

View File

@@ -24,6 +24,17 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
var scope = view.inject(InventoryList, { mode: mode }); // Inject our view var scope = view.inject(InventoryList, { mode: mode }); // Inject our view
scope.selected = []; 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] = "";
});
});
SearchInit({ scope: scope, set: 'inventories', list: list, url: defaultUrl }); SearchInit({ scope: scope, set: 'inventories', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator); scope.search(list.iterator);

View File

@@ -25,6 +25,18 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re
var scope = view.inject(list, { mode: mode }); var scope = view.inject(list, { mode: mode });
scope.selected = []; 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] = "";
});
});
SearchInit({ scope: scope, set: 'job_templates', list: list, url: defaultUrl }); SearchInit({ scope: scope, set: 'job_templates', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator); scope.search(list.iterator);

View File

@@ -22,6 +22,17 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
var scope = view.inject(list, { mode: 'edit' }); var scope = view.inject(list, { mode: 'edit' });
scope.selected = []; 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] = "";
});
});
SearchInit({ scope: scope, set: 'jobs', list: list, url: defaultUrl }); SearchInit({ scope: scope, set: 'jobs', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator); scope.search(list.iterator);

View File

@@ -28,6 +28,17 @@ function OrganizationsList ($scope, $rootScope, $location, $log, Rest, Alert, Lo
LoadBreadCrumbs(); LoadBreadCrumbs();
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] = "";
});
});
// Initialize search and paginate pieces and load data // Initialize search and paginate pieces and load data
SearchInit({ scope: scope, set: list.name, list: list, url: defaultUrl }); SearchInit({ scope: scope, set: list.name, list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });

View File

@@ -24,6 +24,17 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
var scope = view.inject(list, { mode: mode }); var scope = view.inject(list, { mode: mode });
scope.selected = []; 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] = "";
});
});
SearchInit({ scope: scope, set: 'projects', list: list, url: defaultUrl }); SearchInit({ scope: scope, set: 'projects', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
scope.search(list.iterator); scope.search(list.iterator);

View File

@@ -24,14 +24,20 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale
var scope = view.inject(list, { mode: mode }); // Inject our view var scope = view.inject(list, { mode: mode }); // Inject our view
scope.selected = []; scope.selected = [];
// After a refresh, populate the organization name on each row
if (scope.PostRefreshRemove) { if (scope.PostRefreshRemove) {
scope.PostRefreshRemove(); scope.PostRefreshRemove();
} }
scope.PostRefershRemove = scope.$on('PostRefresh', function() { scope.PostRefershRemove = scope.$on('PostRefresh', function() {
// After a refresh, populate the organization name on each row
for( var i=0; i < scope.teams.length; i++) { for( var i=0; i < scope.teams.length; i++) {
scope.teams[i].organization_name = scope.teams[i].summary_fields.organization.name; scope.teams[i].organization_name = scope.teams[i].summary_fields.organization.name;
} }
$("tr.success").each(function(index) {
// Make sure no rows have a green background
var ngc = $(this).attr('ng-class');
scope[ngc] = "";
});
}); });
//SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator }); //SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator });

View File

@@ -24,6 +24,7 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
var mode = (base == 'users') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users var mode = (base == 'users') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users
var scope = view.inject(UserList, { mode: mode }); // Inject our view var scope = view.inject(UserList, { mode: mode }); // Inject our view
scope.selected = []; scope.selected = [];
$rootScope.flashMessage = null; $rootScope.flashMessage = null;
SearchInit({ scope: scope, set: 'users', list: list, url: defaultUrl }); SearchInit({ scope: scope, set: 'users', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });

View File

@@ -12,6 +12,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
'InventoryHelper' 'InventoryHelper'
]) ])
.factory('GroupsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupList', 'GenerateList', .factory('GroupsList', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupList', 'GenerateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ProcessErrors', 'GetBasePath', 'GroupsAdd', 'RefreshTree', 'Prompt', 'SearchInit', 'PaginateInit', 'ProcessErrors', 'GetBasePath', 'GroupsAdd', 'RefreshTree',
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupList, GenerateList, LoadBreadCrumbs, SearchInit, function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupList, GenerateList, LoadBreadCrumbs, SearchInit,
@@ -153,7 +154,6 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
}]) }])
.factory('GroupsAdd', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm', .factory('GroupsAdd', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree', 'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree',
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors, function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
@@ -234,6 +234,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
} }
}]) }])
.factory('GroupsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm', .factory('GroupsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree', 'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree',
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors, function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,

View File

@@ -22,6 +22,7 @@ angular.module('RefreshHelper', ['RestServices', 'Utilities'])
var set = params.set; var set = params.set;
var iterator = params.iterator; var iterator = params.iterator;
var url = params.url; var url = params.url;
Rest.setUrl(url); Rest.setUrl(url);
Rest.get() Rest.get()
.success( function(data, status, headers, config) { .success( function(data, status, headers, config) {