LP#1626157 more accesskeys
authorBill Erickson <berickxx@gmail.com>
Sun, 15 Apr 2018 15:59:12 +0000 (15:59 +0000)
committerBill Erickson <berickxx@gmail.com>
Sun, 15 Apr 2018 15:59:12 +0000 (15:59 +0000)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/accesskey/accesskey-info.component.html
Open-ILS/src/eg2/src/app/share/accesskey/accesskey.directive.ts
Open-ILS/src/eg2/src/app/share/accesskey/accesskey.service.ts
Open-ILS/src/eg2/src/app/share/dialog/dialog.component.ts
Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.ts
Open-ILS/src/eg2/src/app/staff/nav.component.html
Open-ILS/src/eg2/src/app/staff/staff.component.html

index b68129b..06b439b 100644 (file)
@@ -8,6 +8,7 @@
     </button>
   </div>
   <div class="modal-body">
+    <p i18n>Assignments toward the top have higher precedence</p>
     <div class="row border-bottom">
       <div class="col-3 p-1 border-right text-center" i18n>Command</div>
       <div class="col-9 p-1" i18n>Action</div>
index db75b4f..62ff348 100644 (file)
@@ -1,6 +1,8 @@
 /**
- * Assign access keys from within templates via <a> tags.
- * Both href and routerLink attributes are supported.
+ * Assign access keys to <a> tags.
+ *
+ * Access key action is peformed via .click(). hrefs, routerLinks,
+ * and (click) actions are all supported.
  *
  *   <a 
  *     routerLink="/staff/splash"                                           
index e0e1b0b..276f805 100644 (file)
@@ -42,7 +42,9 @@ export class EgAccessKeyService {
             if (keySpec == this.assignments[i].key) {
                 let assign = this.assignments[i];
                 console.debug(`EgAccessKey assignment found for ${assign.key}`);
-                assign.action();
+                // Allow the current digest cycle to complete before
+                // firing the access key action.
+                setTimeout(assign.action, 0);
                 evt.preventDefault();
                 return;
             }
index 4389eb6..4da4f0a 100644 (file)
@@ -28,24 +28,32 @@ export class EgDialogComponent {
     open(): Promise<any> {
 
         if (this.modalRef !== null) {
-            //This can happen when a dialog is dismissed by clicking
-            //outside of the modal.  Avoid treating it like an error.
-            //console.debug('Dismissing existing dialog!');
+            console.warn('Dismissing existing dialog');
             this.dismiss();
         }
 
         this.modalRef = this.modalService.open(this.dialogContent);
-        return this.modalRef.result;
+        return new Promise( (resolve, reject) => {
+
+            this.modalRef.result.then(
+                (result) => {
+                    resolve(result);
+                    this.modalRef = null;
+                },
+                (result) => {
+                    reject(result);
+                    this.modalRef = null;
+                }
+            );
+        });
     }
 
     close(reason?: any): void {
         this.modalRef.close(reason);
-        this.modalRef = null;
     }
 
     dismiss(reason?: any): void {
         this.modalRef.dismiss(reason);
-        this.modalRef = null;
     }
 }
 
index 10a8cb6..d1ae7f2 100644 (file)
@@ -113,8 +113,9 @@ export class WorkstationsComponent implements OnInit {
         this.newName = this.newOwner.shortname() + '-' + this.newName;
 
         this.registerWorkstationApi().then(
-            wsId => this.registerWorkstationLocal(wsId));
-
+            wsId => this.registerWorkstationLocal(wsId),
+            notOk => console.log('Workstation registration canceled/failed')
+        );
     }
 
     private handleCollision(): Promise<number> {
index 9b5d9c2..668f624 100644 (file)
@@ -4,9 +4,9 @@
       <div class="nav-item">
         <a i18n class="nav-link with-material-icon" 
           routerLink="/staff/splash"
-          egAccessKey keySpec="alt+h" keyDesc="My Description" 
-          i18n-keySpec i18n-keyDesc>
-
+          egAccessKey 
+          keySpec="alt+h" i18n-keySpec
+          keyDesc="Navigate Home" i18n-keyDesc>
           <span class="material-icons">home</span>
         </a>
       </div>
             <span class="material-icons">assignment</span>
             <span i18n>Search for Copies by Barcode</span>
           </a>
-          <a class="dropdown-item" routerLink="/staff/catalog/search">
+          <a class="dropdown-item" routerLink="/staff/catalog/search"
+            egAccessKey 
+            keySpec="alt+c" i18n-keySpec
+            keyDesc="Navigate To Catalog" i18n-keyDesc>
             <span class="material-icons">search</span>
             <span i18n>Search the Catalog</span>
           </a>
index 0e94fa6..ab7ba84 100644 (file)
@@ -10,7 +10,7 @@
 <eg-accesskey-info #egAccessKeyInfo></eg-accesskey-info>
 <a egAccessKey 
     keySpec="ctrl+h" i18n-keySpec
-    keyDesc="Show Info Dialog" i18n-keyDesc
+    keyDesc="Display Access Key Info Dialog" i18n-keyDesc
     (click)="egAccessKeyInfo.open()">
 </a>