web staff autogrid
authorBill Erickson <berick@esilibrary.com>
Mon, 24 Mar 2014 15:57:55 +0000 (11:57 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 24 Mar 2014 15:57:55 +0000 (11:57 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
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/autogrid.js

index 0e575c2..ef601a8 100644 (file)
@@ -6,8 +6,6 @@
     background-color: rgb(248, 248, 248);
   }
 
-  .eg-grid-scroll {overflow-y:scroll; height: 600px}
-
   .eg-grid-row {
     width: 100%;
     display: flex;
     padding-right: 1px;
   }
 
+  /* hack to make the header columns line up with the content columns
+     when the scroll bar is visible along the right side of the content
+     columns. TODO: if this varies enough by browser, we'll need to
+     calculate the width instead. */
+  .eg-grid-scroll > .eg-grid-header-row, 
+  .eg-grid-scroll > .eg-grid-conf-row { 
+    padding-right: 15px;
+  }
+  .eg-grid-scroll > .eg-grid-content-body {
+    overflow-y:scroll; 
+    height: 600px; /* TODO: configurable */
+  }
+
 </style>
 
-<div class="eg-grid" ng-class="{'eg-grid-as-conf' : showGridConf}">
+<div class="eg-grid" 
+  ng-class="{'eg-grid-as-conf' : showGridConf,'eg-grid-scroll' : isScroll}">
   <!-- import embedded eg-grid-field defs via no-op transclude -->
   <div ng-transclude></div>
 
 
   <!-- ============== -->
   <!-- grid data rows -->
-  <div class="eg-grid-row" 
-      ng-repeat="item in list.items"
-      ng-class="{'eg-grid-row-selected' : itemIsSelected(item)}">
-    <div class="eg-grid-cell eg-grid-cell-1" 
-      ng-click="handleRowClick($event, item)">
-      {{$index + 1 + list.pageOffset}}
-    </div>
-    <div class="eg-grid-cell eg-grid-cell-1">
-      <!-- ng-click=handleRowClick here has unintended 
-           consequences and is unnecessary, avoid it -->
-      <input type='checkbox'  
-        ng-model="list.selected[list.indexValue(item)]"/>
-    </div>
-    <div class="eg-grid-cell"
-        ng-click="handleRowClick($event, item)"
-        ng-repeat="column in list.allColumns"
-        style="flex:{{column.flex}}"
-        ng-show="list.displayColumns[column.name]">
-      {{list.fieldValue(item, column.name) | egGridvalueFilter:column}}
+  <div class="eg-grid-content-body">
+    <div class="eg-grid-row" 
+        ng-repeat="item in list.items"
+        ng-class="{'eg-grid-row-selected' : itemIsSelected(item)}">
+      <div class="eg-grid-cell eg-grid-cell-1" 
+        ng-click="handleRowClick($event, item)">
+        {{$index + 1 + list.pageOffset}}
+      </div>
+      <div class="eg-grid-cell eg-grid-cell-1">
+        <!-- ng-click=handleRowClick here has unintended 
+             consequences and is unnecessary, avoid it -->
+        <input type='checkbox'  
+          ng-model="list.selected[list.indexValue(item)]"/>
+      </div>
+      <div class="eg-grid-cell"
+          ng-click="handleRowClick($event, item)"
+          ng-repeat="column in list.allColumns"
+          style="flex:{{column.flex}}"
+          ng-show="list.displayColumns[column.name]">
+        {{list.fieldValue(item, column.name) | egGridvalueFilter:column}}
+      </div>
     </div>
   </div>
 </div>
index a7546e3..885c1d4 100644 (file)
@@ -28,7 +28,6 @@
   <eg-grid-field name="parent_ou_shortname" path="parent_ou.shortname" label="[% l('Parent SN') %]"></eg-grid-field>
 </eg-grid>
 
-<!--
 <h1>AutoGrid w/ Auto Fields</h1>
 
 <eg-grid
@@ -38,5 +37,4 @@
   sort="testGridSort"
   query="testGridQuery"
   auto-fields="true"/>
--->
 
index e7f74bd..9bc5978 100644 (file)
@@ -326,7 +326,12 @@ angular.module('egGridMod', ['egCoreMod', 'egListMod', 'egUiMod', 'ui.bootstrap'
         require : '^egGrid',
         restrict : 'AE',
         transclude : true,
-        scope : {name : '@', path : '@', label : '@', flex : '@'},
+        scope : {
+            name  : '@', // required; unique name
+            path  : '@', // optional; flesh path
+            label : '@', // optional; display label
+            flex  : '@', // optoinal; default flex width
+        },
         template : '<div></div>', // NOOP template
         link : function(scope, element, attrs, egGridCtrl) {
             egGridCtrl.addColumn(scope);