From e01c8ad84163468fe9c76584e56c90382fe46069 Mon Sep 17 00:00:00 2001 From: Bill Erickson <berickxx@gmail.com> Date: Wed, 15 Jan 2020 11:14:06 -0500 Subject: [PATCH] LP1859706 Map Angular cat "Patron View" to AngJS "OPAC View" 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> Signed-off-by: Ruth Frasur <rfrasur@gmail.com> --- .../src/app/staff/catalog/record/record.component.html | 4 ++-- .../eg2/src/app/staff/catalog/record/record.component.ts | 4 ++-- Open-ILS/web/js/ui/default/staff/cat/catalog/app.js | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html index 51d81b330c..cf082f9668 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html @@ -36,7 +36,7 @@ </div> <ngb-tabset #recordTabs [activeId]="recordTab" (tabChange)="beforeTabChange($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> @@ -83,7 +83,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> diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts index 9c0ce9d762..dc8d8dfce8 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts @@ -44,7 +44,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. @@ -58,7 +58,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(); diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index f05c363295..491b6ca10b 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -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'; } @@ -2006,8 +2014,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'; -- 2.11.0