web staff : list api cleanup
authorBill Erickson <berick@esilibrary.com>
Mon, 4 Nov 2013 19:12:10 +0000 (14:12 -0500)
committerBill Erickson <berick@esilibrary.com>
Mon, 4 Nov 2013 19:13:54 +0000 (14:13 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/web/js/ui/default/staff/services/list.js

index 18e7f97..f06e7b1 100644 (file)
@@ -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) {