LP#1676608: allow focus-me to accept constant
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 22 Feb 2018 20:44:52 +0000 (15:44 -0500)
committerMike Rylander <mrylander@gmail.com>
Wed, 28 Feb 2018 15:26:43 +0000 (10:26 -0500)
A handfull of cases have arisen, including but not limited to
the copy alerts feature, where focus-me is set to simply "true"
rather than being bound to to a scope variable. This patch formalizes
this and gets rid of the following console warning:

angular.min.js:119 TypeError: model.assign is not a function
    at ui.js:23
    at angular.min.js:160
    at f (angular.min.js:45)
    at angular.min.js:48
(anonymous) @ angular.min.js:119

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/web/js/ui/default/staff/services/ui.js

index fb48ea0..b39c33b 100644 (file)
@@ -20,7 +20,8 @@ function($timeout , $parse) {
             });
             element.bind('blur', function() {
                 $timeout(function() {
-                    scope.$apply(model.assign(scope, false));
+                    if (model.assign && typeof model.assign == 'function')
+                        scope.$apply(model.assign(scope, false));
                 });
             })
         }