-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bhFormDefaults): form defaults automatically (#542)
This commit adds a new directive `bhFormDefaults` to automatically add attributes to any form element. These attributes are: 1. `autocomplete` 2. `autocapitalize` 3. `autocorrect` The directive turns them off by setting them to "none". If a browser updates in the future to ignore the "none" directive, they can easily be updated. Closes #502.
- Loading branch information
Showing
49 changed files
with
511 additions
and
531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
angular.module('bhima.directives') | ||
.directive('bhFormDefaults', bhFormDefaults); | ||
|
||
/** | ||
* @class bhFormDefaults | ||
* | ||
* @description | ||
* The bhFormDefaults directive allows us to set custom attributes on any form | ||
* in the application and ensure they all behave the same. It also creates a | ||
* single location for changing any of the attributes on the form in the future. | ||
*/ | ||
function bhFormDefaults() { | ||
return { | ||
restrict: 'A', | ||
require: 'form', | ||
link: function bhFormDefaultsLinkFn($scope, $element, $attrs, $controller) { | ||
$attrs.$set('autocomplete', 'none'); | ||
$attrs.$set('autocapitalize', 'none'); | ||
$attrs.$set('autocorrect', 'none'); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.