From 782b39c2d2a228065fd705688930611a45b51351 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 3 Aug 2021 10:42:02 -0400 Subject: [PATCH] portal: add catalogsearch and link items Also make autofocus on the catalog search input work Signed-off-by: Galen Charlton --- .../src/eg2/src/app/staff/splash.component.html | 139 ++++----------------- Open-ILS/src/eg2/src/app/staff/splash.component.ts | 15 ++- Open-ILS/src/eg2/src/app/staff/staff.module.ts | 3 +- 3 files changed, 39 insertions(+), 118 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/splash.component.html b/Open-ILS/src/eg2/src/app/staff/splash.component.html index 16389b7b3c..620876b409 100644 --- a/Open-ILS/src/eg2/src/app/staff/splash.component.html +++ b/Open-ILS/src/eg2/src/app/staff/splash.component.html @@ -37,125 +37,38 @@

{{entry.label()}}

- - - - - -
- - -
-
-
-

Item Search and Cataloging

-
-
-
-
-
- - - - - -
-
- -
- - - Item Buckets - +
+
+ + + +
-
-
-
- - +
diff --git a/Open-ILS/src/eg2/src/app/staff/splash.component.ts b/Open-ILS/src/eg2/src/app/staff/splash.component.ts index a847c3f581..78c05ca794 100644 --- a/Open-ILS/src/eg2/src/app/staff/splash.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/splash.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, Renderer2} from '@angular/core'; +import {Component, OnInit, AfterViewInit, Directive, ElementRef, Renderer2} from '@angular/core'; import {PcrudService} from '@eg/core/pcrud.service'; import {Router} from '@angular/router'; @@ -26,9 +26,6 @@ export class StaffSplashComponent implements OnInit { } this.portalEntries[page_col][item.col_pos()] = item; }); - - // Focus catalog search form - this.renderer.selectRootElement('#catalog-search-input').focus(); } searchCatalog(): void { @@ -41,4 +38,14 @@ export class StaffSplashComponent implements OnInit { } } +@Directive({ + selector: '[autofocus]' +}) +export class AutofocusDirective implements AfterViewInit { + constructor(private host: ElementRef) {} + ngAfterViewInit() { + console.log('fo'); + this.host.nativeElement.focus(); + } +} diff --git a/Open-ILS/src/eg2/src/app/staff/staff.module.ts b/Open-ILS/src/eg2/src/app/staff/staff.module.ts index dd22f93e17..34bf589ef7 100644 --- a/Open-ILS/src/eg2/src/app/staff/staff.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/staff.module.ts @@ -5,7 +5,7 @@ import {StaffComponent} from './staff.component'; import {StaffRoutingModule} from './routing.module'; import {StaffNavComponent} from './nav.component'; import {StaffLoginComponent} from './login.component'; -import {StaffSplashComponent} from './splash.component'; +import {StaffSplashComponent, AutofocusDirective} from './splash.component'; import {AboutComponent} from './about.component'; @NgModule({ @@ -13,6 +13,7 @@ import {AboutComponent} from './about.component'; StaffComponent, StaffNavComponent, StaffSplashComponent, + AutofocusDirective, StaffLoginComponent, AboutComponent ], -- 2.11.0