LP#1707063: Naive ng-class test for last-column-modified
authorMike Rylander <mrylander@gmail.com>
Mon, 29 Jan 2018 21:37:15 +0000 (16:37 -0500)
committerKathy Lussier <klussier@masslnc.org>
Fri, 25 May 2018 20:40:53 +0000 (16:40 -0400)
Instead of comparing a (potentially undefined) property of a column, we'll
just compare the column object directly when checking to see if a column
header should be highlighted for "last touched in editing mode."

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/share/t_autogrid.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index 4a91d0c..0519012 100644 (file)
     </div>
     <div class="eg-grid-cell"
         eg-grid-column-drag-dest
-        ng-class="{'eg-grid-column-last-mod' : lastModColumn==col.name}"
+        ng-class="{'eg-grid-column-last-mod' : isLastModifiedColumn(col)}"
         column="{{col.name}}"
         eg-right-click="onContextMenu($event)"
         ng-repeat="col in columns"
index fc3a05b..15d61f2 100644 (file)
@@ -765,10 +765,16 @@ angular.module('egGridMod',
                     column.flex = 1;
             }
             $scope.modifyColumnFlex = function(col, val) {
-                $scope.lastModColumn = col.name;
+                $scope.lastModColumn = col;
                 grid.modifyColumnFlex(col, val);
             }
 
+            $scope.isLastModifiedColumn = function(col) {
+                if ($scope.lastModColumn)
+                    return $scope.lastModColumn === col;
+                return false;
+            }
+
             grid.modifyColumnPos = function(col, diff) {
                 var srcIdx, targetIdx;
                 angular.forEach(grid.columnsProvider.columns,
@@ -801,7 +807,7 @@ angular.module('egGridMod',
             }
 
             $scope.modifyColumnPos = function(col, diff) {
-                $scope.lastModColumn = col.name;
+                $scope.lastModColumn = col;
                 return grid.modifyColumnPos(col, diff);
             }