LP1869906 Angular staff cat browse links
authorBill Erickson <berickxx@gmail.com>
Tue, 31 Mar 2020 15:51:41 +0000 (11:51 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Fri, 1 May 2020 13:30:59 +0000 (09:30 -0400)
Use routerLinks instead of click-handlers for browse results links so
users have the option to control-click and open individual results in a
new tab.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/eg2/src/app/staff/catalog/browse/results.component.html
Open-ILS/src/eg2/src/app/staff/catalog/browse/results.component.ts

index fdbb054..f30ceda 100644 (file)
@@ -39,7 +39,8 @@
       <div class="col-lg-8">
         <div class="card-body">
           <ng-container *ngIf="result.sources > 0">
-            <a (click)="searchByBrowseEntry(result)" href="javascript:void(0)">
+            <a routerLink="/staff/catalog/search"
+              [queryParams]="searchByBrowseEntryParams(result)">
                 {{result.value}} ({{result.sources}})
             </a>
           </ng-container>
@@ -62,7 +63,8 @@
                     Related term
                 </ng-container>
               </span>
-              <a (click)="newBrowseFromHeading(heading)" href="javascript:void(0)">
+              <a routerLink="/staff/catalog/browse"
+                [queryParams]="newBrowseFromHeadingParams(heading)">
                 {{heading.heading}} ({{heading.target_count}})
               </a>
             </div>
index e8b3499..3aeaf6b 100644 (file)
@@ -117,21 +117,20 @@ export class BrowseResultsComponent implements OnInit, OnDestroy {
         }
     }
 
-    searchByBrowseEntry(result) {
-
-        // Avoid propagating browse values to term search.
-        this.searchContext.browseSearch.reset();
-
-        this.searchContext.termSearch.hasBrowseEntry =
+    searchByBrowseEntryParams(result) {
+        const ctx = this.searchContext.clone();
+        ctx.browseSearch.reset(); // we're done browsing
+        ctx.termSearch.hasBrowseEntry =
             result.browse_entry + ',' + result.fields;
-        this.staffCat.search();
+        return this.catUrl.toUrlParams(ctx);
     }
 
     // NOTE: to test unauthorized heading display in concerto
     // browse for author = kab
-    newBrowseFromHeading(heading) {
-        this.searchContext.browseSearch.value = heading.heading;
-        this.staffCat.browse();
+    newBrowseFromHeadingParams(heading) {
+        const ctx = this.searchContext.clone();
+        ctx.browseSearch.value = heading.heading;
+        return this.catUrl.toUrlParams(ctx);
     }
 }