GUAC-1053: Properly handle undefined form/field/option names.

This commit is contained in:
Michael Jumper
2015-04-17 21:23:01 -07:00
parent f0d7b6f867
commit dbeb68cc1d
2 changed files with 10 additions and 2 deletions

View File

@@ -104,6 +104,10 @@ angular.module('form').directive('guacForm', [function form() {
*/
$scope.getSectionHeader = function getSectionHeader(form) {
// If no form, or no name, then no header
if (!form || !form.name)
return '';
return translationStringService.canonicalize($scope.namespace || 'MISSING_NAMESPACE')
+ '.SECTION_HEADER_' + translationStringService.canonicalize(form.name);
@@ -128,6 +132,10 @@ angular.module('form').directive('guacForm', [function form() {
*/
$scope.getFieldHeader = function getFieldHeader(field) {
// If no field, or no name, then no header
if (!field || !field.name)
return '';
return translationStringService.canonicalize($scope.namespace || 'MISSING_NAMESPACE')
+ '.FIELD_HEADER_' + translationStringService.canonicalize(field.name);

View File

@@ -131,8 +131,8 @@ angular.module('form').directive('guacFormField', [function formField() {
*/
$scope.getFieldOption = function getFieldOption(value) {
// Don't bother if the model is not yet defined
if (!$scope.field)
// If no field, or no value, then no corresponding translation string
if (!$scope.field || !$scope.field.name || !value)
return '';
return translationStringService.canonicalize($scope.namespace || 'MISSING_NAMESPACE')