LP#1626157 more accesskeys
authorBill Erickson <berickxx@gmail.com>
Sun, 15 Apr 2018 19:42:07 +0000 (19:42 +0000)
committerBill Erickson <berickxx@gmail.com>
Sun, 15 Apr 2018 19:42:07 +0000 (19:42 +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-info.component.ts
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/staff/nav.component.html
Open-ILS/src/eg2/src/app/staff/staff.component.html

index 06b439b..b221c1c 100644 (file)
@@ -8,14 +8,15 @@
     </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>
+      <div class="col-6 p-1 border-right" i18n>Action</div>
+      <div class="col-3 p-1" i18n>Context</div>
     </div>
     <div class="row border-bottom" *ngFor="let a of assignments()">
       <div class="col-3 p-1 border-right text-center">{{a.key}}</div>
-      <div class="col-9 p-1">{{a.desc}}</div>
+      <div class="col-6 p-1 border-right">{{a.desc}}</div>
+      <div class="col-3 p-1">{{a.ctx}}</div>
     </div>
   </div>
   <div class="modal-footer">
index d74d7a1..c925a50 100644 (file)
@@ -12,8 +12,7 @@ import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
 export class EgAccessKeyInfoComponent extends EgDialogComponent {
 
        constructor(
-        // NgbModal import required for subclassing with a constructor.
-        private modal: NgbModal,
+        private modal: NgbModal, // required for passing to parent
         private keyService: EgAccessKeyService) {
         super(modal);
     }
index 62ff348..8e58ab1 100644 (file)
@@ -21,6 +21,7 @@ export class EgAccessKeyDirective implements OnInit {
 
     @Input() keySpec: string;
     @Input() keyDesc: string;
+    @Input() keyCtx: string;
     
        constructor(
         private elm: ElementRef,
@@ -35,8 +36,10 @@ export class EgAccessKeyDirective implements OnInit {
         this.keyService.assign({
             key: this.keySpec, 
             desc: this.keyDesc,
+            ctx: this.keyCtx,
             action: () => {this.elm.nativeElement.click()}
         });
+
     }
 }
 
index 276f805..1a3dab3 100644 (file)
@@ -1,9 +1,10 @@
 import {Injectable, EventEmitter, HostListener} from '@angular/core';
 
 export interface EgAccessKeyAssignment {
-    key: string,
-    desc: string,
-    action: Function
+    key: string,     // keyboard command
+    desc: string,    // human-friendly description
+    ctx: string,     // template context 
+    action: Function // handler function
 };
 
 @Injectable()
@@ -58,7 +59,7 @@ export class EgAccessKeyService {
      */
     infoIze(): any[] {
         return this.assignments.map(a => {
-            return {key: a.key, desc: a.desc};
+            return {key: a.key, desc: a.desc, ctx: a.ctx};
         });
     }
 
index 668f624..4b1dd4b 100644 (file)
@@ -4,7 +4,7 @@
       <div class="nav-item">
         <a i18n class="nav-link with-material-icon" 
           routerLink="/staff/splash"
-          egAccessKey 
+          egAccessKey keyCtx="navbar"
           keySpec="alt+h" i18n-keySpec
           keyDesc="Navigate Home" i18n-keyDesc>
           <span class="material-icons">home</span>
@@ -27,7 +27,7 @@
             <span i18n>Search for Copies by Barcode</span>
           </a>
           <a class="dropdown-item" routerLink="/staff/catalog/search"
-            egAccessKey 
+            egAccessKey keyCtx="navbar"
             keySpec="alt+c" i18n-keySpec
             keyDesc="Navigate To Catalog" i18n-keyDesc>
             <span class="material-icons">search</span>
index ab7ba84..ac17f7a 100644 (file)
@@ -8,9 +8,9 @@
 
 <!-- EgAccessKey Info Panel -->
 <eg-accesskey-info #egAccessKeyInfo></eg-accesskey-info>
-<a egAccessKey 
+<a egAccessKey keyCtx="base"
     keySpec="ctrl+h" i18n-keySpec
-    keyDesc="Display Access Key Info Dialog" i18n-keyDesc
+    keyDesc="Display AccessKey Info Dialog" i18n-keyDesc
     (click)="egAccessKeyInfo.open()">
 </a>