GUACAMOLE-302: Additions made to the username and password field types so that they can now be manually focussed using the custom guacFocus directive.

This commit is contained in:
m-khan-glyptodon
2019-06-07 14:30:24 -07:00
parent 19f0de4ebc
commit eb50c5c0e8
3 changed files with 11 additions and 2 deletions

View File

@@ -187,6 +187,15 @@ angular.module('form').directive('guacForm', [function form() {
});
/**
* 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);
};

View File

@@ -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>

View File

@@ -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"