webstaff: Integrate Monograph Parts UI
authorMike Rylander <mrylander@gmail.com>
Mon, 20 Apr 2015 20:38:13 +0000 (16:38 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:16 +0000 (13:39 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index 872a6cc..3dc6fd2 100644 (file)
         [% l('View Holds') %]
     </a>
   </li>
+  <li ng-class="{disabled : !record_id, active : record_tab == 'monoparts'}">
+    <a ng-click="set_record_tab('monoparts')" >
+        [% l('Monograph Parts') %]
+    </a>
+  </li>
 </ul>
 
 <div class="tab-content">
@@ -65,5 +70,8 @@
     <div ng-if="record_tab == 'holds'">
       [% INCLUDE 'staff/cat/catalog/t_holds.tt2' %]
     </div>
+    <div ng-if="record_tab == 'monoparts'">
+      <eg-embed-frame frame="parts_iframe" save-space="350" url="parts_url"></eg-embed-frame>
+    </div>
   </div>
 </div>
index 6fa704b..437f62c 100644 (file)
@@ -160,12 +160,14 @@ function($scope , $routeParams , $location , $q , egCore , egHolds,
 
     // will hold a ref to the opac iframe
     $scope.opac_iframe = null;
+    $scope.parts_iframe = null;
+
     $scope.in_opac_call = false;
     $scope.opac_call = function (opac_frame_function, force_opac_tab) {
         if ($scope.opac_iframe) {
             if (force_opac_tab) $scope.record_tab = 'catalog';
             $scope.in_opac_call = true;
-            $scope.opac_iframe.contentWindow[opac_frame_function]();
+            $scope.opac_iframe.dom.contentWindow[opac_frame_function]();
         }
     }
 
@@ -173,11 +175,12 @@ function($scope , $routeParams , $location , $q , egCore , egHolds,
     $scope.$watch('stop_unload',
         function(newVal, oldVal) {
             if (newVal && newVal != oldVal && $scope.opac_iframe) {
-                $($scope.opac_iframe.contentWindow).on('beforeunload', function(){
+                $($scope.opac_iframe.dom.contentWindow).on('beforeunload', function(){
                     return 'There is unsaved data in this record.'
                 });
             } else {
-                $($scope.opac_iframe.contentWindow).off('beforeunload');
+                if ($scope.opac_iframe)
+                    $($scope.opac_iframe.dom.contentWindow).off('beforeunload');
             }
         }
     );
@@ -198,6 +201,7 @@ function($scope , $routeParams , $location , $q , egCore , egHolds,
         if (match) {
             $scope.record_id = match[1];
             egCore.hatch.setLocalItem("eg.cat.last_record_retrieved", $scope.record_id);
+            init_parts_url();
         } else {
             delete $scope.record_id;
             $scope.from_route = false;
@@ -334,11 +338,24 @@ function($scope , $routeParams , $location , $q , egCore , egHolds,
         $scope.catalog_url = url;
     }
 
+    function init_parts_url() {
+        $scope.parts_url = $location
+            .absUrl()
+            .replace(
+                /\/staff.*/,
+                '/conify/global/biblio/monograph_part?r='+$scope.record_id
+            );
+    }
+
     $scope.set_record_tab = function(tab) {
         $scope.record_tab = tab;
 
         switch(tab) {
 
+            case 'monoparts':
+                init_parts_url();
+                break;
+
             case 'catalog':
                 init_cat_url();
                 break;