LP1859706 Map Angular cat "Patron View" to AngJS "OPAC View" user/berick/lp1859706-catalog-patron-view-default-tab
authorBill Erickson <berickxx@gmail.com>
Wed, 15 Jan 2020 16:14:06 +0000 (11:14 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 15 Jan 2020 16:14:09 +0000 (11:14 -0500)
The Angular catalog now treats the "Patron View" tab as the same as
the "OPAC View" tab in the AngJS catalog for the purposes of saving a
preferred default tab.

Similarly, the Angular catalog-only "Item Table" tab maps to the AngJS
"OPAC View" tab, since it's the closest analog.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html
Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index 98a270b..ecd94bc 100644 (file)
@@ -27,7 +27,7 @@
       </div>
     </div>
     <ngb-tabset #recordTabs [activeId]="recordTab" (tabChange)="onTabChange($event)">
-      <ngb-tab title="Item Table" i18n-title id="catalog">
+      <ngb-tab title="Item Table" i18n-title id="item_table">
         <ng-template ngbTabContent>
           <eg-catalog-copies [recordId]="recordId"></eg-catalog-copies>
         </ng-template>
@@ -74,7 +74,7 @@
           </eg-catalog-record-conjoined>
         </ng-template>
       </ngb-tab>
-      <ngb-tab title="Patron View" i18n-title id="opac">
+      <ngb-tab title="Patron View" i18n-title id="catalog">
         <ng-template ngbTabContent>
           <eg-opac-record-detail [recordId]="recordId">
           </eg-opac-record-detail>
index 83ce9b3..061eba4 100644 (file)
@@ -38,7 +38,7 @@ export class RecordComponent implements OnInit {
 
         this.defaultTab =
             this.store.getLocalItem('eg.cat.default_record_tab')
-            || 'catalog';
+            || 'item_table';
 
         // Watch for URL record ID changes
         // This includes the initial route.
@@ -52,7 +52,7 @@ export class RecordComponent implements OnInit {
             this.searchContext = this.staffCat.searchContext;
 
             if (!this.recordTab) {
-                this.recordTab = this.defaultTab || 'catalog';
+                this.recordTab = this.defaultTab || 'item_table';
             }
 
             this.loadRecord();
index 0793e01..3b22879 100644 (file)
@@ -630,6 +630,14 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
         });
     }
 
+    // Map the Angular catalog-only 'item_table' tab to the AngJS
+    // 'catalog' tab.
+    function get_default_record_tab() {
+        var tab = egCore.hatch.getLocalItem('eg.cat.default_record_tab');
+        if (!tab || tab === 'item_table') { return 'catalog'; }
+        return tab;
+    }
+
     // also set it when the iframe changes to a new record
     $scope.handle_page = function(url) {
 
@@ -669,8 +677,8 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
         // or we didn't change records on the OPAC load
         if (!$scope.in_opac_call && ($scope.record_id != prev_record_id)) {
             if ($scope.record_id) {
-                $scope.default_tab = egCore.hatch.getLocalItem( 'eg.cat.default_record_tab' );
-                tab = $routeParams.record_tab || $scope.default_tab || 'catalog';
+                $scope.default_tab = get_default_record_tab();
+                tab = $routeParams.record_tab || $scope.default_tab;
             } else {
                 tab = $routeParams.record_tab || 'catalog';
             }
@@ -1986,8 +1994,8 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
 
     var tab;
     if ($scope.record_id) {
-        $scope.default_tab = egCore.hatch.getLocalItem( 'eg.cat.default_record_tab' );
-        tab = $routeParams.record_tab || $scope.default_tab || 'catalog';
+        $scope.default_tab = get_default_record_tab();
+        tab = $routeParams.record_tab || $scope.default_tab;
 
     } else {
         tab = $routeParams.record_tab || 'catalog';