GUACAMOLE-302: Additions made to the username and password field types so that they can now be manually focussed using the custom guacFocus directive.
diff --git a/guacamole/src/main/webapp/app/form/directives/form.js b/guacamole/src/main/webapp/app/form/directives/form.js
index 925128b..81f500f 100644
--- a/guacamole/src/main/webapp/app/form/directives/form.js
+++ b/guacamole/src/main/webapp/app/form/directives/form.js
@@ -187,6 +187,15 @@
});
+ /**
+ * Returns whether the given field should be focused or not.
+ *
+ * @param {Field} field
+ * The field to check.
+ *
+ * @returns {Boolean}
+ * true if the given field should be focused, false otherwise.
+ */
$scope.isFocused = function isFocused(field) {
return field && (field.name === $scope.focused);
};
diff --git a/guacamole/src/main/webapp/app/form/templates/passwordField.html b/guacamole/src/main/webapp/app/form/templates/passwordField.html
index 56472ef..68d36f7 100644
--- a/guacamole/src/main/webapp/app/form/templates/passwordField.html
+++ b/guacamole/src/main/webapp/app/form/templates/passwordField.html
@@ -1,4 +1,4 @@
<div class="password-field">
- <input type="{{passwordInputType}}" ng-disabled="disabled" ng-model="model" ng-trim="false" autocorrect="off" autocapitalize="off"/>
+ <input type="{{passwordInputType}}" ng-disabled="disabled" ng-model="model" ng-trim="false" guac-focus="focused" autocorrect="off" autocapitalize="off"/>
<div class="icon toggle-password" ng-click="togglePassword()" title="{{getTogglePasswordHelpText() | translate}}"></div>
</div>
\ No newline at end of file
diff --git a/guacamole/src/main/webapp/app/form/templates/textField.html b/guacamole/src/main/webapp/app/form/templates/textField.html
index 819ae03..6abd4f6 100644
--- a/guacamole/src/main/webapp/app/form/templates/textField.html
+++ b/guacamole/src/main/webapp/app/form/templates/textField.html
@@ -1,5 +1,5 @@
<div class="text-field">
- <input type="text" ng-model="model" autocorrect="off" autocapitalize="off"
+ <input type="text" ng-model="model" autocorrect="off" autocapitalize="off" guac-focus="focused"
ng-disabled="disabled" ng-attr-list="{{ dataListId }}"/>
<datalist ng-if="dataListId" id="{{ dataListId }}">
<option ng-repeat="option in field.options | orderBy: option"