egRfidTarget directive user/gmcharlt/rfid-page-title
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 27 Mar 2017 21:45:00 +0000 (17:45 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 27 Mar 2017 21:45:00 +0000 (17:45 -0400)
This directive appends " (RFID: On)" to the end of the window
title whenever an input using it has focus.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2
Open-ILS/src/templates/staff/circ/patron/t_bcsearch.tt2
Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2
Open-ILS/web/js/ui/default/staff/services/ui.js

index ccc7e5d..b7e747e 100644 (file)
@@ -57,6 +57,7 @@
           class="form-control"
           ng-model="checkinArgs.copy_barcode" 
           placeholder="[% l('Barcode') %]"
+          eg-rfid-target
           id="patron-checkin-barcode" type="text"/> 
 
         <input type="submit" class="btn btn-default" value="[% l('Submit') %]"/>
index 6a9e8fa..3038478 100644 (file)
@@ -8,6 +8,7 @@
     <input select-me="selectMe" class="form-control"
       ng-model="args.barcode" 
       placeholder="[% l('Patron Barcode') %]"
+      eg-rfid-target
       id="patron-checkout-barcode" type="text"/> 
 
     <input class="btn btn-default" type="submit" value="[% l('Submit') %]"/>
index b2df987..9ff8b02 100644 (file)
@@ -26,6 +26,7 @@
 
         <input focus-me="focusMe" class="form-control"
           ng-model="checkoutArgs.copy_barcode" 
+          eg-rfid-target
           ng-disabled="checkoutArgs.noncat_type != 'barcode' || disable_checkout()"
           id="patron-checkout-barcode" type="text"/> 
 
index 7328e7d..483f275 100644 (file)
@@ -3,6 +3,21 @@
   */
 angular.module('egUiMod', ['egCoreMod', 'ui.bootstrap'])
 
+.directive('egRfidTarget',
+    ['$window',
+function($window) {
+    return {
+        link: function(scope, element, attrs) {
+            var origTitle = $window.document.title;
+            element.bind('focus', function(e) {
+                $window.document.title = origTitle + ' (RFID: On)';
+            });
+            element.bind('blur', function(e) {
+                $window.document.title = origTitle;
+            });
+        }
+    };
+}])
 
 /**
  * <input focus-me="iAmOpen"/>