AC-697 Dynamic help on Permissions page based on Permission Type. Uses a help collapse. Added ngBind support to help collapse, allowing the controller to set a scope variable to an html string. Added a Permissions.js helper to share setting help text and other defaults whenever permission type changes.

This commit is contained in:
Chris Houseknecht
2013-12-02 21:34:53 +00:00
parent a21a740bad
commit 2dd2fb95ac
7 changed files with 87 additions and 48 deletions

View File

@@ -0,0 +1,48 @@
/*********************************************
* Copyright (c) 2013 AnsibleWorks, Inc.
*
* Permissions.js
*
* Functions shared amongst Permission related controllers
*
*/
angular.module('PermissionsHelper', [])
// Handle category change event
.factory('PermissionCategoryChange', [ function() {
return function(params) {
var scope = params.scope;
var reset = params.reset;
if (scope.category == 'Inventory') {
scope.projectrequired = false;
scope.permissionTypeHelp =
"<dl>\n" +
"<dt>Admin</dt>\n" +
"<dd>Allow the user or team full access to the inventory. This includes reading, writing, deletion of the inventory and inventory sync operations.</dd>\n" +
"<dt>Read</dt>\n" +
"<dd>Only allow the user or team to view the inventory.</dd>\n" +
"<dt>Write</dt>\n" +
"<dd>Allow the user or team to modify hosts and groups contained in the inventory, add new hosts and groups, and perform inventory sync operations.\n" +
"</dl>\n";
}
else {
scope.projectrequired = true;
scope.permissionTypeHelp =
"<dl>\n" +
"<dt>Run</dt>\n" +
"<dd>Allow the user or team to perform a live deployment of the project against the inventory. In Run mode modules will " +
"be executed, and changes to the inventory will occur.</dd>\n" +
"<dt>Check</dt>\n" +
"<dd>Only allow the user or team to deploy the project against the inventory as a dry-run operation. In Check mode, module operations " +
"will only be simulated. No changes will occur.</dd>\n" +
"</dl>\n";
}
if (reset) {
scope.permission_type = null;
}
}
}]);