On Permissions detail page, Permission radio button is now required and validation works correctly.

This commit is contained in:
chouseknecht 2013-06-26 12:14:21 -04:00
parent cfb638e8e1
commit 453c13f116
3 changed files with 11 additions and 1 deletions

View File

@ -135,6 +135,7 @@ function PermissionsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
else {
scope.projectrequired = true;
}
scope.permission_type = null;
}
}
@ -246,6 +247,7 @@ function PermissionsEdit ($scope, $rootScope, $compile, $location, $log, $routeP
else {
scope.projectrequired = true;
}
scope.permission_type = null;
}
}

View File

@ -70,7 +70,9 @@ angular.module('PermissionFormDefinition', [])
{label: 'Write', value: 'write', ngShow: "category == 'Inventory'" },
{label: 'Run', value: 'run', ngShow: "category == 'Deploy'" },
{label: 'Check', value: 'check', ngShow: "category == 'Deploy'" }
]
],
addRequired: true,
editRequired: true
}
/* ,
deployment_permission_type: {

View File

@ -399,9 +399,15 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
html += "ng-model=\"" + fld + "\" ";
html += (field.ngChange) ? this.attr(field,'ngChange') : "";
html += (field.readonly) ? "readonly " : "";
html += (options.mode == 'edit' && field.editRequired) ? "required " : "";
html += (options.mode == 'add' && field.addRequired) ? "required " : "";
html += " /> " + field.options[i].label + "\n";
html += "</label>\n";
}
if ( (options.mode == 'add' && field.addRequired) || (options.mode == 'edit' && field.editRequired) ) {
html += "<span class=\"error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
this.form.name + '_form.' + fld + ".$error.required\">A value is required!</span>\n";
}
html += "<p><span class=\"error api-error\" ng-bind=\"" + fld + "_api_error\"></span></p>\n";
html += "</div>\n";
html += "</div>\n";