skip firing onchange event with invalid page ('{{url}}')
authora. bellenir <ab@grpl.org>
Sat, 19 May 2018 19:02:48 +0000 (15:02 -0400)
committera. bellenir <ab@grpl.org>
Sat, 19 May 2018 19:02:48 +0000 (15:02 -0400)
something sets the iframe url to '$BASE_URL/{{url}}' (encoded as '%7B%7Burl%7D%7D') when the page is reloaded or the URL is accessed directly.
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js cannot extract the record id from this value, so a blank page is ultimately loaded.
superfluous reloads can be avoided by skipping the $scope.onchange event when the new url is invalid (ends with '{{url}}').

Signed-off-by: a. bellenir <ab@grpl.org>
Open-ILS/web/js/ui/default/staff/services/eframe.js

index 5096165..50eb10d 100644 (file)
@@ -295,7 +295,8 @@ angular.module('egCoreMod')
                     });
                 }
 
-                if ($scope.onchange) $scope.onchange(page);
+                // skip firing onchange if page url ends with "{{url}}"
+                if ($scope.onchange && !page.match(/%7B%7Burl%7D%7D$/)) $scope.onchange(page);
             }
 
             // open a new tab with the embedded URL