web staff autogrid; porting items out experiment
authorBill Erickson <berick@esilibrary.com>
Mon, 24 Mar 2014 23:39:26 +0000 (19:39 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 24 Mar 2014 23:39:26 +0000 (19:39 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_items_out_table.tt2
Open-ILS/src/templates/staff/parts/t_autogrid.tt2
Open-ILS/src/templates/staff/test/t_autogrid.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js
Open-ILS/web/js/ui/default/staff/services/list.js

index 65721dc..7101811 100644 (file)
@@ -4,30 +4,14 @@
   persist-key="eg.staff.circ.patron.items_out"
   eg-list="items_out"
   id-field="id">
-  <eg-grid-field name="id"></eg-grid-field>
-  <eg-grid-field 
-    name="target_copy.barcode" 
-    path="target_copy.barcode" 
-    flex="3"
-    label="[% l('Barcode') %]">
-  </eg-grid-field>
-  <eg-grid-field 
-    name="due_date"
-    label="[% l('Due Date') %]">
-  </eg-grid-field>
-  <eg-grid-field 
-    name="circ_lib.shortname" 
-    path="circ_lib.shortname"
-    label="[% l('Circ Lib') %]">
-  </eg-grid-field>
-  <eg-grid-field name="renewal_remaining"></eg-grid-field>
-  <eg-grid-field name="stop_fines"></eg-grid-field>
-  <eg-grid-field 
-    name="title" 
-    flex="5"
-    label="[% l('Title') %]" 
-    path="target_copy.call_number.record.simple_record.title">
-  </eg-grid-field>
+  <eg-grid-field path="id"></eg-grid-field>
+  <eg-grid-field path="target_copy.barcode" flex="3" label="[% l('Barcode') %]"> </eg-grid-field>
+  <eg-grid-field path="due_date" label="[% l('Due Date') %]"></eg-grid-field>
+  <eg-grid-field path="circ_lib.shortname" label="[% l('Circ Lib') %]"></eg-grid-field>
+  <eg-grid-field path="renewal_remaining"></eg-grid-field>
+  <eg-grid-field path="stop_fines"></eg-grid-field>
+  <eg-grid-field flex="5" label="[% l('Title') %]" 
+    path="target_copy.call_number.record.simple_record.title"> </eg-grid-field>
 </eg-grid>
 
 <!-- TODO: row-level styling, alerts, etc. (e.g. overdue) -->
index 9f525f0..45987c2 100644 (file)
           ng-repeat="column in list.allColumns"
           style="flex:{{column.flex}}"
           ng-show="list.displayColumns[column.name]">
-        {{list.fieldValue(item, column.path) | egGridvalueFilter:column}}
+        {{fieldValue(item, column.name) | egGridvalueFilter:column}}
       </div>
     </div>
   </div>
index a8d201e..a164670 100644 (file)
     eg-grid-field's require closing tags; 
     you can also do <div eg-grid-tag attrs..></div>
   -->
-  <eg-grid-field name="shortname" label="[% l('Shortname') %]"></eg-grid-field>
-  <eg-grid-field name="name" flex="5"></eg-grid-field>
-  <eg-grid-field name="id"></eg-grid-field>
-  <eg-grid-field name="depth" path="ou_type.depth"></eg-grid-field>
-  <eg-grid-field name="billing_addr" flex="3"path="billing_address.street1"></eg-grid-field>
-  <eg-grid-field name="opac_visible"></eg-grid-field>
-  <eg-grid-field name="phone"></eg-grid-field>
-  <eg-grid-field name="email"></eg-grid-field>
-  <eg-grid-field name="type" path="ou_type.name" flex="3"></eg-grid-field>
-  <eg-grid-field name="can_have_vols" path="ou_type.can_have_vols"></eg-grid-field>
-  <eg-grid-field name="can_have_users" path="ou_type.can_have_users"></eg-grid-field>
-  <eg-grid-field name="parent_ou_id" path="parent_ou.id"></eg-grid-field>
-  <eg-grid-field name="parent_ou_name" path="parent_ou.name" flex="5" label="[% l('Parent Org') %]"></eg-grid-field>
-  <eg-grid-field name="parent_ou_depth" path="parent_ou.ou_type.depth" label="[% l('Parent Depth') %]"></eg-grid-field>
-  <eg-grid-field name="parent_ou_shortname" path="parent_ou.shortname" label="[% l('Parent SN') %]"></eg-grid-field>
+  <eg-grid-field path="shortname" label="[% l('Shortname') %]"></eg-grid-field>
+  <eg-grid-field path="name" flex="5"></eg-grid-field>
+  <eg-grid-field path="id"></eg-grid-field>
+  <eg-grid-field path="ou_type.depth"></eg-grid-field>
+  <eg-grid-field path="billing_address.street1" flex="3"></eg-grid-field>
+  <eg-grid-field path="opac_visible"></eg-grid-field>
+  <eg-grid-field path="phone"></eg-grid-field>
+  <eg-grid-field path="email"></eg-grid-field>
+  <eg-grid-field path="ou_type.name" flex="3"></eg-grid-field>
+  <eg-grid-field path="ou_type.can_have_vols"></eg-grid-field>
+  <eg-grid-field path="ou_type.can_have_users"></eg-grid-field>
+  <eg-grid-field path="parent_ou.id"></eg-grid-field>
+  <eg-grid-field path="parent_ou.name" flex="5" label="[% l('Parent Org') %]"></eg-grid-field>
+  <eg-grid-field path="parent_ou.ou_type.depth" label="[% l('Parent Depth') %]"></eg-grid-field>
+  <eg-grid-field path="parent_ou.shortname" label="[% l('Parent SN') %]"></eg-grid-field>
 </eg-grid>
 
 <!--
index 90545c0..16b7d22 100644 (file)
@@ -60,9 +60,6 @@ angular.module('egGridMod', ['egCoreMod', 'egListMod', 'egUiMod', 'ui.bootstrap'
 
             $scope.list = $scope.egList || egList.create();
 
-            $scope.$watch('isScroll', function(newValue, oldValue) {
-                console.log('isScroll changed to ' + newValue) });
-
             // column-header click quick sort
             $scope.sortOn = function(col_name) {
                 if ($scope.sort && $scope.sort.length &&
@@ -127,19 +124,28 @@ angular.module('egGridMod', ['egCoreMod', 'egListMod', 'egUiMod', 'ui.bootstrap'
             this.addColumn = function(fieldSpec) {
 
                 var field = {
-                    name : fieldSpec.name,
+                    name  : fieldSpec.name,
                     label : fieldSpec.label,
-                    path : fieldSpec.path,
-                    flex : fieldSpec.flex,
+                    path  : fieldSpec.path,
+                    flex  : fieldSpec.flex,
                     datatype : fieldSpec.datatype,
-                    display : (fieldSpec.display !== false)
+                    display  : (fieldSpec.display !== false)
                 };
-                if (!field.path) field.path = field.name;
+
                 if (!field.name) field.name = field.path;
+                if (!field.path) field.path = field.name;
+
                 field = self.absorbField(field);
                 $scope.list.addColumn(field);
             }
 
+            $scope.fieldValue = function(item, key) {
+                if ($scope.egList) 
+                    return $scope.list.fieldValue(item, key);
+                // if we are managing the data, then our data is flat
+                return item[key];
+            }
+
             /**
              * Caller wants to display all fields for the selected IDL class
              * Find the fields and, when a field is a link, fetch the label
@@ -225,7 +231,7 @@ angular.module('egGridMod', ['egCoreMod', 'egListMod', 'egUiMod', 'ui.bootstrap'
                 var new_field = {
                     name : field.name,
                     label : field.label,
-                    path : field.path || field.name,
+                    path : field.path,
                     flex : Number(field.flex) || 2,
                     display : (field.display === false) ? false : true
                 };
index 32bee97..6181db6 100644 (file)
@@ -224,6 +224,7 @@ angular.module('egListMod', ['egCoreMod'])
          * To avoid ambiguity, automatically added column labels are
          * prefixed with the class label.
          */
+        /* TODO: deprecate me with grid.js */
         this.addColumnsForClass = function(cls, base) {
             var idlClass = egIDL.classes[cls];
             angular.forEach(idlClass.fields, function(field) {
@@ -283,6 +284,9 @@ angular.module('egListMod', ['egCoreMod'])
         // corresponding output filter.
         // TODO: support modifying field values -- 
         // useful for inline table editing
+
+        // TODO: this can be trimmed down, specifically the filter
+        // stuff in light of grid.js
         this.fieldValue = function(obj, dotpath) {
             if (!obj) return '';
             if (!dotpath) return obj;