From: Bill Erickson Date: Mon, 4 Nov 2013 19:12:10 +0000 (-0500) Subject: web staff : list api cleanup X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=aa5faece7f99cf6c9ce4030ab8ba5e54a8391be0;p=evergreen%2Fequinox.git web staff : list api cleanup Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/staff/services/list.js b/Open-ILS/web/js/ui/default/staff/services/list.js index 18e7f97502..f06e7b16d3 100644 --- a/Open-ILS/web/js/ui/default/staff/services/list.js +++ b/Open-ILS/web/js/ui/default/staff/services/list.js @@ -48,7 +48,7 @@ angular.module('egListMod', ['egCoreMod']) this.displayColumns = {}; // {index => true} map of selected rows - this.selectedRows = {}; + this.selected = {}; this.indexValue = function(item) { if (this.indexFieldAsFunction) { @@ -64,7 +64,7 @@ angular.module('egListMod', ['egCoreMod']) angular.forEach( this.items, function(item) { - if (self.selectedRows[self.indexValue(item)]) + if (self.selected[self.indexValue(item)]) items.push(item); } ); @@ -77,7 +77,7 @@ angular.module('egListMod', ['egCoreMod']) if (self.indexValue(item) == index) self.items.splice(idx, 1); }); - delete this.selectedRows[index]; + delete this.selected[index]; } this.count = function() { return this.items.length } @@ -86,13 +86,13 @@ angular.module('egListMod', ['egCoreMod']) this.offset = 0; this.totalCount = 0; this.items = []; - this.selectedRows = {}; + this.selected = {}; } // prepare to draw a new page of data this.resetPageData = function() { this.items = []; - this.selectedRows = {}; + this.selected = {}; } this.showAllColumns = function() { @@ -108,39 +108,39 @@ angular.module('egListMod', ['egCoreMod']) } // selects one row after deselecting all of the others - this.selectOneRow = function(index) { - this.deselectAllRows(); - this.selectedRows[index] = true; + this.selectOne = function(index) { + this.deselectAll(); + this.selected[index] = true; } // selects or deselects a row, without affecting the others - this.toggleOneRowSelection = function(index) { - if (this.selectedRows[index]) { - delete this.selectedRows[index]; + this.toggleOneSelection = function(index) { + if (this.selected[index]) { + delete this.selected[index]; } else { - this.selectedRows[index] = true; + this.selected[index] = true; } } // selects all visible rows - this.selectAllRows = function() { + this.selectAll = function() { angular.forEach(this.items, function(item) { - self.selectedRows[self.indexValue(item)] = true + self.selected[self.indexValue(item)] = true }); } // if all are selected, deselect all, otherwise select all this.toggleSelectAll = function() { - if (Object.keys(this.selectedRows).length == this.items.length) { - this.deselectAllRows(); + if (Object.keys(this.selected).length == this.items.length) { + this.deselectAll(); } else { - this.selectAllRows(); + this.selectAll(); } } // deselects all visible rows - this.deselectAllRows = function() { - this.selectedRows = {}; + this.deselectAll = function() { + this.selected = {}; } this.defaultColumns = function(list) {