]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8026 [Verto-Communicator] #resolve Add an autofocus directive to both dialpad...
authorJoao Mesquita <jmesquita@indicium.com.ar>
Mon, 24 Aug 2015 13:18:25 +0000 (10:18 -0300)
committerJoao Mesquita <jmesquita@indicium.com.ar>
Mon, 24 Aug 2015 13:18:25 +0000 (10:18 -0300)
html5/verto/verto_communicator/js/directives.js
html5/verto/verto_communicator/partials/dialpad.html
html5/verto/verto_communicator/partials/login.html

index 5b809f6ea6d6aec74a60fffb90c1baa6afb768cc..9514d754f0f9cd1e7da048d4f9429f9373651550 100644 (file)
@@ -85,3 +85,25 @@ vertoDirectives.directive('showControls',
       link: link
     };
   });
+
+/*
+Sometimes autofocus HTML5 directive just isn't enough with SPAs.
+This directive will force autofocus to work properly under those circumstances.
+*/
+(function () {
+  'use strict';
+
+  vertoDirectives.directive('autofocus', ['$timeout',
+    function ($timeout) {
+      return {
+        restrict: 'A',
+        link: function ($scope, $element) {
+          $timeout(function () {
+            console.log('Focusing...');
+            $element[0].focus();
+          });
+        }
+      };
+    }
+  ]);
+})();
\ No newline at end of file
index 3addb72c23f1560dc40b3d50257315b3e5ee6e54..a6348bf3bca78300134507c9bdcf15e4fcd7c724 100644 (file)
@@ -41,7 +41,7 @@
               <i class="mdi-action-settings-phone"></i>
             </a>
           </span>
-          <input name="dialpadnumber" type="text" class="form-control text-center" placeholder="Enter an extension" ng-model="dialpadNumber" />
+          <input name="dialpadnumber" type="text" class="form-control text-center" placeholder="Enter an extension" ng-model="dialpadNumber" autofocus/>
           <span class="input-group-btn">
             <a href="" ng-click="backspace()">
               <i class="mdi-content-backspace"></i>
index 47cfae47919e82d6e89e879cab102e558a17d7c1..9df7ba184bd4c507e7bd249c4930b9f9c7d8ac98 100644 (file)
@@ -11,7 +11,7 @@
         <form name="form" class="css-form" novalidate ng-init="advanced = false">
           <div class="form-group {{ (((!form.name.$pristine || form.$submitted) && !form.name.$valid) ? 'has-error': '') }}">
             <label class="control-label" for="login-name">Name</label>
-            <input type="text" name="name" class="form-control" id="login-name" placeholder="Your name" required="" ng-model="verto.data.name">
+            <input type="text" name="name" class="form-control" id="login-name" placeholder="Your name" required="" ng-model="verto.data.name" autofocus>
           </div>
           <div class="form-group {{ (((!form.email.$pristine || form.$submitted) && !form.email.$valid) ? 'has-error': '') }}">
             <label class="control-label" for="login-email">Email</label>