Apply focus to the element tab-previous to the OK/Continue button in alert popups
authorMike Rylander <mrylander@gmail.com>
Wed, 31 Aug 2016 16:37:14 +0000 (12:37 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 31 Aug 2017 17:23:17 +0000 (13:23 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/templates/staff/share/t_copy_alert_manager_dialog.tt2
Open-ILS/web/js/ui/default/staff/services/ui.js

index 39d3d58..c19f9a2 100644 (file)
@@ -3,7 +3,7 @@
 -->
 <div>
   <div class="modal-header">
-    <button type="button" class="close" 
+    <button type="button" class="close" focus-me="no_statuses"
       ng-click="cancel()" aria-hidden="true">&times;</button>
     <h4 class="modal-title alert alert-info">[% l('Copy alerts') %]</h4> 
   </div>
@@ -33,7 +33,7 @@
             <label for="select-next-status"><b>[% l('Next copy status') %]<b></label>
           </div>
           <div class="col-md-4">
-            <select id="select-next-status" class="form-control"
+            <select id="select-next-status" class="form-control" focus-me="has_statuses"
                     ng-model="params.the_next_status"
                     ng-options="st.id() as st.name() for st in next_statuses">
             </select>
index 49dacd6..447245a 100644 (file)
@@ -663,6 +663,8 @@ function($uibModal , $interpolate , egCore) {
 
                     var next_statuses = [];
                     var seen_statuses = {};
+                    $scope.has_statuses = false;
+                    $scope.no_statuses = true;
                     $scope.next_statuses = [];
                     $scope.params = {
                         'the_next_status' : null
@@ -681,6 +683,10 @@ function($uibModal , $interpolate , egCore) {
                                     if (!seen_statuses[st]) {
                                         seen_statuses[st] = true;
                                         next_statuses.push(st);
+                                        if (next_statuses.length > 1) {
+                                            $scope.no_statuses = false;
+                                            $scope.has_statuses = true;
+                                        }
                                     }
                                 });
                             }