LP#1402797 implement Show All in Catalog action for record buckets
authorGalen Charlton <gmc@esilibrary.com>
Thu, 15 Jan 2015 16:16:03 +0000 (16:16 +0000)
committerBill Erickson <berickxx@gmail.com>
Wed, 25 Feb 2015 16:16:05 +0000 (11:16 -0500)
Note that this will typically require the brower's pop-up
blocker to be disabled for the webstaff site.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/cat/bucket/record/t_view.tt2
Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js

index 39c866f..b6768c5 100644 (file)
@@ -10,6 +10,9 @@
   [% INCLUDE 'staff/cat/bucket/record/t_grid_menu.tt2' %]
 
   <!-- actions drop-down -->
+  <eg-grid-action label="[% l('Show All in Catalog') %]"
+    handler="showAllRecords"></eg-grid-action>
+
   <eg-grid-action label="[% l('Remove Selected Records') %]" 
     handler="detachRecords"></eg-grid-action>
 
index 937218e..5b4ad21 100644 (file)
@@ -484,8 +484,10 @@ function($scope,  $routeParams,  bucketSvc , egGridDataProvider) {
 }])
 
 .controller('ViewCtrl',
-       ['$scope','$q','$routeParams','bucketSvc',
-function($scope,  $q , $routeParams,  bucketSvc) {
+       ['$scope','$q','$routeParams','bucketSvc', 'egCore', '$window',
+        '$timeout',
+function($scope,  $q , $routeParams,  bucketSvc, egCore, $window,
+        $timeout) {
 
     $scope.setTab('view');
     $scope.bucketId = $routeParams.id;
@@ -513,6 +515,18 @@ function($scope,  $q , $routeParams,  bucketSvc) {
         );
     }
 
+    $scope.showAllRecords = function() {
+        // TODO: maybe show selected would be better?
+        // TODO: probably want to set a limit on the number of
+        //       new tabs one could choose to open at once
+        angular.forEach(bucketSvc.currentBucket.items(), function(rec) {
+            var url = egCore.env.basePath +
+                      'cat/catalog/record/' +
+                      rec.target_biblio_record_entry();
+            $timeout(function() { $window.open(url, '_blank') });
+        });
+    }
+
     $scope.detachRecords = function(records) {
         var promises = [];
         angular.forEach(records, function(rec) {