From 774738110b5a16efab6ab7b65ec2893ae1bf1edf Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Sun, 17 Sep 2017 17:07:19 +0200 Subject: [PATCH] feat(auth): add an auto-focus directive and remove username placeholder --- app/components/auth/auth.html | 2 +- app/components/initAdmin/initAdmin.html | 2 +- app/directives/autofocus.js | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 app/directives/autofocus.js diff --git a/app/components/auth/auth.html b/app/components/auth/auth.html index fe53cc0b5..f58276395 100644 --- a/app/components/auth/auth.html +++ b/app/components/auth/auth.html @@ -16,7 +16,7 @@
- +
diff --git a/app/components/initAdmin/initAdmin.html b/app/components/initAdmin/initAdmin.html index 775a1b5e9..6fbcccaf9 100644 --- a/app/components/initAdmin/initAdmin.html +++ b/app/components/initAdmin/initAdmin.html @@ -36,7 +36,7 @@
- +
diff --git a/app/directives/autofocus.js b/app/directives/autofocus.js new file mode 100644 index 000000000..0b9029c33 --- /dev/null +++ b/app/directives/autofocus.js @@ -0,0 +1,14 @@ +angular +.module('portainer') +.directive('autoFocus', ['$timeout', function porAutoFocus($timeout) { + var directive = { + restrict: 'A', + link: function($scope, $element) { + $timeout(function() { + $element[0].focus(); + }); + } + }; + + return directive; +}]);