catalog record / html view
authorBill Erickson <berick@esilibrary.com>
Wed, 16 Jul 2014 18:25:10 +0000 (14:25 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 16 Jul 2014 18:25:10 +0000 (14:25 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/cat/catalog/index.tt2
Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
Open-ILS/web/js/ui/default/staff/services/eframe.js

index 61e4862..9a207d8 100644 (file)
@@ -1,11 +1,12 @@
 [%
   WRAPPER "staff/base.tt2";
-  ctx.page_title = l("Record Buckets"); 
+  ctx.page_title = l("Catalog"); 
   ctx.page_app = "egCatalogApp";
 %]
 
 [% BLOCK APP_JS %]
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/eframe.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/record.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/catalog/app.js"></script>
 [% END %]
 
diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2
new file mode 100644 (file)
index 0000000..a21e45c
--- /dev/null
@@ -0,0 +1,36 @@
+
+<div class="row pad-vert">
+  <div class="col-md-9">
+    <div class="alert alert-info alert-less-pad strong-text-2">
+      <span>[% l('Catalog') %]</span>
+    </div>
+  </div>
+  <div class="col-md-3">
+    <div class="btn-group pull-right" dropdown>
+      <button type="button" class="btn btn-default dropdown-toggle" ng-disabled="!record_id">
+        [% l('Actions for This Record') %] 
+        <span class="caret"></span>
+      </button>
+      <ul class="dropdown-menu dropdown-menu-right" role="menu">
+        <li><a href dropdown-toggle ng-click="set_record_tab('catalog')">[% l('OPAC View') %]</a></li>
+        <li><a href dropdown-toggle ng-click="set_record_tab('record_html')">[% l('MARC View') %]</a></li>
+        <li class="divider"></li>
+        <li class="disabled"><a href dropdown-toggle>[% l('View Holds') %]</a></li>
+        <li class="disabled"><a href dropdown-toggle>[% l('Mark as Title Hold Transfer Destination') %]</a></li>
+        <li class="disabled"><a href dropdown-toggle>[% l('Transfer All Title Holds') %]</a></li>
+      </ul>
+    </div>
+  </div>
+</div>
+
+<div class="pad-vert">
+  <!-- ng-show allows the catalog iframe to stay loaded (unlike ng-if) -->
+  <div ng-show="record_tab == 'catalog'">
+    <eg-embed-frame url="catalog_url" handlers="handlers" onchange="handle_page"></eg-embed-frame>
+  </div>
+  <!-- ng-if the remaining tabs so they can be instantiated on demand -->
+  <div ng-if="record_tab == 'record_html'">
+    <eg-record-html record-id="record_id"></eg-record-html>
+  </div>
+</div>
+
index 99ce5f7..e9bd6e0 100644 (file)
@@ -12,7 +12,13 @@ angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod'])
         ['egStartup', function(egStartup) {return egStartup.go()}]}
 
     $routeProvider.when('/cat/catalog/index', {
-        template: '<eg-embed-frame url="catalog_url" handlers="handlers"></eg-embed-frame>',
+        templateUrl: './cat/catalog/t_catalog',
+        controller: 'CatalogCtrl',
+        resolve : resolver
+    });
+
+    $routeProvider.when('/cat/catalog/record/:record_id', {
+        templateUrl: './cat/catalog/t_catalog',
         controller: 'CatalogCtrl',
         resolve : resolver
     });
@@ -30,8 +36,33 @@ function($scope , $routeParams , $location , egCore) {
     // TODO: is start path configurable in the xul client?
     var url = $location.absUrl().replace(/\/staff.*/, '/opac/advanced');
 
+    if ($routeParams.record_id) {
+        $scope.record_id = $routeParams.record_id;
+        url = url.replace(/advanced/, '/record/' + $scope.record_id);
+    }
+
     // pass the reg URL into the scope, thus into the 
     $scope.catalog_url = url;
+    // default to catalog view of the record page
+    $scope.record_tab = 'catalog';
+
+    $scope.set_record_tab = function(tab) {
+        $scope.record_tab = tab;
+    }
+
+    $scope.handle_page = function(url) {
+        var match = url.match(/\/+opac\/+record\/+(\d+)/);
+        if (match) {
+            $scope.record_id = match[1];
+            console.debug('loading record ' + $scope.record_id);
+
+            // force the record_id to show up in the page.  
+            // not sure why a $digest isn't occuring here.
+            try { $scope.$apply() } catch(E) {}
+        } else {
+            delete $scope.record_id;
+        }
+    }
 
     $scope.handlers = {};
 }])
index fa5207e..fbbf886 100644 (file)
@@ -13,7 +13,10 @@ angular.module('egCoreMod')
 
             // optional hash of functions which augment or override 
             // the stock xulG functions defined below.
-            handlers : '='
+            handlers : '=',
+
+            // called after onload of each new iframe page
+            onchange : '='
         },
 
         template : '<iframe src="{{url}}" onload="egEmbedFrameLoader(this)" '
@@ -25,7 +28,7 @@ angular.module('egCoreMod')
 
             // Set the iframe height to just under the window height.
             // leave room for the navbar, padding, margins, etc.
-            $scope.height = $window.outerHeight - 250;
+            $scope.height = $window.outerHeight - 300;
 
             // browser client doesn't use cookies, so we don't load the
             // (at the time of writing, quite limited) angular.cookies
@@ -62,7 +65,9 @@ angular.module('egCoreMod')
             // NOTE: catalog integration is not a stop-gap
             $window.egEmbedFrameLoader = function(iframe) {
 
-                console.debug('egEmbedFrameLoader()...');
+                var page = iframe.contentWindow.location.href;
+                console.debug('egEmbedFrameLoader(): ' + page);
+                if ($scope.onchange) $scope.onchange(page);
 
                 // tell the iframe'd window its inside the staff client
                 iframe.contentWindow.IAMXUL = true;