From b8ea6d763bb6abf7b23213ed68ebcfc08be653be Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Tue, 19 Nov 2019 00:36:30 -0500 Subject: [PATCH] tweak Create and Clone Selection List dialogs Auto-focus and clear the input widgets, and default the clone widget to "Copy of " --- .../src/app/staff/acq/search/picklist-clone-dialog.component.ts | 5 ++++- .../src/app/staff/acq/search/picklist-create-dialog.component.ts | 8 +++++++- .../eg2/src/app/staff/acq/search/picklist-results.component.ts | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-clone-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-clone-dialog.component.ts index 63996dcce8..27aef6cd07 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-clone-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-clone-dialog.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core'; +import {Component, Input, ViewChild, TemplateRef, OnInit, Renderer2} from '@angular/core'; import {Observable, from, empty, throwError} from 'rxjs'; import {DialogComponent} from '@eg/share/dialog/dialog.component'; import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; @@ -25,6 +25,7 @@ export class PicklistCloneDialogComponent @ViewChild('fail', { static: true }) private fail: AlertDialogComponent; constructor( + private renderer: Renderer2, private idl: IdlService, private evt: EventService, private net: NetService, @@ -39,6 +40,8 @@ export class PicklistCloneDialogComponent update() { this.leadListName = this.grid.context.getSelectedRows()[0].name(); + this.renderer.selectRootElement('#create-picklist-name').focus(); + this.selectionListName = 'Copy of ' + this.leadListName; } cloneList() { diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-create-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-create-dialog.component.ts index 2325aae7f1..97aee859da 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-create-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-create-dialog.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core'; +import {Component, Input, ViewChild, TemplateRef, OnInit, Renderer2} from '@angular/core'; import {Observable, from, empty, throwError} from 'rxjs'; import {DialogComponent} from '@eg/share/dialog/dialog.component'; import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; @@ -22,6 +22,7 @@ export class PicklistCreateDialogComponent @ViewChild('fail', { static: true }) private fail: AlertDialogComponent; constructor( + private renderer: Renderer2, private idl: IdlService, private evt: EventService, private net: NetService, @@ -35,6 +36,11 @@ export class PicklistCreateDialogComponent this.selectionListName = ''; } + update() { + this.selectionListName = ''; + this.renderer.selectRootElement('#create-picklist-name').focus(); + } + createList() { const picklist = this.idl.create('acqpl'); picklist.owner(this.auth.user().id()) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts index a373e1f43c..059772cf5d 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts @@ -76,6 +76,7 @@ export class PicklistResultsComponent implements OnInit { this.picklistResultsGrid.reload(); // FIXME - spec calls for inserted grid row and not refresh } ); + this.picklistCreateDialog.update(); // clear and focus the textbox } openCloneDialog(rows: IdlObject[]) { -- 2.11.0