mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
AC-633 fixed a sort of unrelated js error. The capitalize filter directive attempted to act on a 'null' input error. Added a test to ignore empty/null input.
This commit is contained in:
@@ -11,12 +11,14 @@ angular.module('AWFilters', [])
|
|||||||
//
|
//
|
||||||
.filter('capitalize', function() {
|
.filter('capitalize', function() {
|
||||||
return function(input) {
|
return function(input) {
|
||||||
var values = input.replace(/\_/g,' ').split(" ");
|
if (input) {
|
||||||
var result = "";
|
var values = input.replace(/\_/g,' ').split(" ");
|
||||||
for (i = 0; i < values.length; i++){
|
var result = "";
|
||||||
result += values[i].charAt(0).toUpperCase() + values[i].substr(1) + ' ';
|
for (i = 0; i < values.length; i++){
|
||||||
|
result += values[i].charAt(0).toUpperCase() + values[i].substr(1) + ' ';
|
||||||
|
}
|
||||||
|
result = result.trim();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
result = result.trim();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user