Index: tools/skpdiff/diff_viewer.js |
diff --git a/tools/skpdiff/diff_viewer.js b/tools/skpdiff/diff_viewer.js |
index 700bf4b0e4f6a958605769f9cac5b1dfb0b13c10..6d498641ff1448ad0d25b96b5d43a58c62f8054b 100644 |
--- a/tools/skpdiff/diff_viewer.js |
+++ b/tools/skpdiff/diff_viewer.js |
@@ -28,10 +28,10 @@ directive('swapImg', function() { |
image = rightImage; |
} |
- // Make it so the maximum size of an image is 500, and the images are scaled |
+ // Make it so the maximum size of an image is 400, and the images are scaled |
epoger
2013/08/02 14:33:06
Please create a constant, near the top of the file
Zach Reizner
2013/08/02 21:30:58
Done.
|
// down in halves. |
var divisor = 1; |
- while ((image.width / divisor) > 500) { |
+ while ((image.width / divisor) > 400) { |
divisor *= 2; |
} |
@@ -74,7 +74,7 @@ directive('swapImg', function() { |
}; |
}); |
-function DiffListController($scope) { |
+function DiffListController($scope, $http, $timeout) { |
// Label each kind of differ for the sort buttons. |
$scope.differs = [ |
{ |
@@ -100,4 +100,31 @@ function DiffListController($scope) { |
$scope.sortingDiffer = function(record) { |
return record.diffs[$scope.sortIndex].result; |
}; |
+ |
+ // Flash status indicators on the rows, and then remove them so the style can potentially be |
+ // reapplied later. |
epoger
2013/08/02 14:33:06
Is this hosted somewhere that I can look at it, an
Zach Reizner
2013/08/02 21:30:58
Nope. Never done that before on the corp network.
epoger
2013/08/06 15:26:43
It's easy to do. See the "User directories" secti
|
+ $scope.flashRowStatus = function(success, record) { |
+ var flashStyle = success ? "success-flash" : "failure-flash"; |
+ var flashDuration = success ? 500 : 800; |
epoger
2013/08/02 14:33:06
I take it this is in milliseconds? If so, please
Zach Reizner
2013/08/02 21:30:58
Done.
|
+ |
+ // Store the style in the record. The row will pick up the style this way instead of through |
+ // index because index can change with sort order. |
+ record.cssClasses = flashStyle; |
+ |
+ // The animation cannot be repeated unless the class is removed the element. |
+ $timeout(function() { |
+ record.cssClasses = ""; |
+ }, flashDuration); |
+ } |
+ |
+ $scope.setHashOf = function(imagePath, record) { |
+ $http.post("/set_hash", { |
+ "path": imagePath |
+ }).success(function(data) { |
+ $scope.flashRowStatus(data.success, record); |
+ }).error(function() { |
+ $scope.flashRowStatus(false, record); |
+ }); |
+ |
+ }; |
} |