LP1852782 Catalog search form expand/collapse
authorBill Erickson <berickxx@gmail.com>
Fri, 6 Dec 2019 18:02:55 +0000 (13:02 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 21 Feb 2020 16:44:38 +0000 (11:44 -0500)
Collapse the form by default on record detail pages for closer
consistency with previous catalogs.  When collapsed, provide an option
to expand the search form.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts

index d032f3d..f5d2e50 100644 (file)
@@ -1,7 +1,15 @@
-<!--
-TODO focus search input
--->
-<div id='staffcat-search-form' class="row pt-3 pb-3 mb-3">
+<div id='staffcat-search-form'>
+
+  <div *ngIf="!showThyself" class="row pt-1 pb-1 mb-2 pr-2">
+    <div class="col-lg-12 d-flex">
+      <div class="flex-1"></div><!-- push right -->
+      <a (click)="showThyself=true" class="label-with-material-icon no-href" i18n>
+        Show Search Form <span class="material-icons">unfold_more</span>
+      </a>
+    </div>
+  </div>
+  
+  <div *ngIf="showThyself" class="row pt-3 pb-3 mb-3">
   <div class="col-lg-8">
     <ngb-tabset #searchTabs [activeId]="searchTab" (tabChange)="onTabChange($event)">
       <ngb-tab title="Keyword Search" i18n-title id="term">
@@ -351,5 +359,6 @@ TODO focus search input
       </div>
     </div>
   </div>
+  </div>
 </div>
 
index 84dd830..42e7086 100644 (file)
@@ -1,5 +1,5 @@
 import {Component, OnInit, AfterViewInit, Renderer2} from '@angular/core';
-import {ActivatedRoute} from '@angular/router';
+import {Router, ActivatedRoute, NavigationEnd} from '@angular/router';
 import {IdlObject} from '@eg/core/idl.service';
 import {OrgService} from '@eg/core/org.service';
 import {CatalogService} from '@eg/share/catalog/catalog.service';
@@ -21,8 +21,12 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
     copyLocations: IdlObject[];
     searchTab: string;
 
+    // Display the full form if true, otherwise display the expandy.
+    showThyself = true;
+
     constructor(
         private renderer: Renderer2,
+        private router: Router,
         private route: ActivatedRoute,
         private org: OrgService,
         private cat: CatalogService,
@@ -39,6 +43,16 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
                 this.searchTab = params.searchTab;
             }
         });
+
+        this.router.events.subscribe(routeEvent => {
+            if (routeEvent instanceof NavigationEnd) {
+                if (routeEvent.url.match(/catalog\/record/)) {
+                    this.showThyself = false;
+                } else {
+                    this.showThyself = true;
+                }
+            }
+        });
     }
 
     ngOnInit() {