1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

changed some lookup dialogs to use radio buttons

This commit is contained in:
Jared Tabor 2014-08-21 12:02:33 -04:00
parent d1e8d98b29
commit a3c9dc7deb
10 changed files with 56 additions and 29 deletions

View File

@ -159,7 +159,8 @@ function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $routePar
form: form,
current_item: (!Empty($routeParams.user_id)) ? $routeParams.user_id : null,
list: UserList,
field: 'user'
field: 'user',
input_type: 'radio'
});
LookUpInit({
@ -314,7 +315,8 @@ function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $routePa
form: form,
current_item: (!Empty($scope.user_id)) ? $scope.user_id : null,
list: UserList,
field: 'user'
field: 'user',
input_type: 'radio'
});
LookUpInit({

View File

@ -400,7 +400,8 @@ function InventoriesAdd($scope, $rootScope, $compile, $location, $log, $routePar
form: form,
current_item: ($routeParams.organization_id) ? $routeParams.organization_id : null,
list: OrganizationList,
field: 'organization'
field: 'organization',
input_type: 'radio'
});
// Save

View File

@ -161,7 +161,8 @@ function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $routePa
form: form,
current_item: null,
list: InventoryList,
field: 'inventory'
field: 'inventory',
input_type: "radio"
});
// Clone the CredentialList object for use with cloud_credential. Cloning
@ -177,7 +178,8 @@ function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $routePa
current_item: null,
list: CloudCredentialList,
field: 'cloud_credential',
hdr: 'Select Cloud Credential'
hdr: 'Select Cloud Credential',
input_type: 'radio'
});
LookUpInit({
@ -187,7 +189,8 @@ function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $routePa
current_item: null,
list: CredentialList,
field: 'credential',
hdr: 'Select Machine Credential'
hdr: 'Select Machine Credential',
input_type: "radio"
});
// Update playbook select whenever project value changes
@ -262,7 +265,8 @@ function JobTemplatesAdd($scope, $rootScope, $compile, $location, $log, $routePa
form: form,
current_item: null,
list: ProjectList,
field: 'project'
field: 'project',
input_type: "radio"
});
function saveCompleted() {
@ -535,7 +539,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
current_item: $scope.cloud_credential,
list: CloudCredentialList,
field: 'cloud_credential',
hdr: 'Select Cloud Credential'
hdr: 'Select Cloud Credential',
input_type: "radio"
});
$scope.$emit('jobTemplateLoadFinished');
});
@ -639,7 +644,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
form: form,
current_item: data.inventory,
list: InventoryList,
field: 'inventory'
field: 'inventory',
input_type: "radio"
});
LookUpInit({
@ -649,7 +655,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
current_item: data.credential,
list: CredentialList,
field: 'credential',
hdr: 'Select Machine Credential'
hdr: 'Select Machine Credential',
input_type: "radio"
});
LookUpInit({
@ -657,7 +664,8 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
form: form,
current_item: data.project,
list: ProjectList,
field: 'project'
field: 'project',
input_type: "radio"
});
RelatedSearchInit({

View File

@ -129,7 +129,8 @@ function PermissionsAdd($scope, $rootScope, $compile, $location, $log, $routePar
form: form,
current_item: null,
list: InventoryList,
field: 'inventory'
field: 'inventory',
input_type: 'radio'
});
LookUpInit({
@ -249,7 +250,8 @@ function PermissionsEdit($scope, $rootScope, $compile, $location, $log, $routePa
form: form,
current_item: data.inventory,
list: InventoryList,
field: 'inventory'
field: 'inventory',
input_type: "radio"
});
LookUpInit({

View File

@ -434,7 +434,8 @@ function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $routeParams
scope: $scope,
form: form,
list: OrganizationList,
field: 'organization'
field: 'organization',
input_type: 'radio'
});
LookUpInit({
@ -442,7 +443,8 @@ function ProjectsAdd($scope, $rootScope, $compile, $location, $log, $routeParams
url: GetBasePath('credentials') + '?kind=scm',
form: form,
list: CredentialList,
field: 'credential'
field: 'credential',
input_type: "radio"
});
// Save
@ -545,7 +547,11 @@ function ProjectsEdit($scope, $rootScope, $compile, $location, $log, $routeParam
relatedSets = {};
SchedulesList.well = false;
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.inject(form, {
mode: 'edit',
related: true,
scope: $scope
});
generator.reset();
$scope.project_local_paths = [];
@ -597,7 +603,8 @@ function ProjectsEdit($scope, $rootScope, $compile, $location, $log, $routeParam
scope: $scope,
form: form,
list: CredentialList,
field: 'credential'
field: 'credential',
input_type: 'radio'
});
$scope.pathRequired = ($scope.scm_type.value === '') ? true : false;

View File

@ -7,13 +7,13 @@
* Controller functions for the Team model.
*
*/
'use strict';
function TeamsList($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, TeamList, GenerateList, LoadBreadCrumbs,
Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, SetTeamListeners, GetBasePath, SelectionInit, Wait,
Stream) {
ClearScope();
var list = TeamList,
@ -22,7 +22,7 @@ function TeamsList($scope, $rootScope, $location, $log, $routeParams, Rest, Aler
paths = $location.path().replace(/^\//, '').split('/'),
mode = (paths[0] === 'teams') ? 'edit' : 'select',
url;
generator.inject(list, { mode: mode, scope: $scope });
$scope.selected = [];
@ -121,7 +121,7 @@ function TeamsAdd($scope, $rootScope, $compile, $location, $log, $routeParams, T
form = TeamForm,
generator = GenerateForm,
scope = generator.inject(form, { mode: 'add', related: false });
$rootScope.flashMessage = null;
generator.reset();
LoadBreadCrumbs();
@ -131,7 +131,8 @@ function TeamsAdd($scope, $rootScope, $compile, $location, $log, $routeParams, T
form: form,
current_item: null,
list: OrganizationList,
field: 'organization'
field: 'organization',
input_type: 'radio'
});
// Save
@ -173,7 +174,7 @@ TeamsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$r
function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm, GenerateForm, Rest, Alert, ProcessErrors,
LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt, GetBasePath, CheckAccess,
OrganizationList, Wait, Stream) {
ClearScope();
var defaultUrl = GetBasePath('teams'),
@ -253,7 +254,8 @@ function TeamsEdit($scope, $rootScope, $compile, $location, $log, $routeParams,
form: form,
current_item: data.organization,
list: OrganizationList,
field: 'organization'
field: 'organization',
input_type: 'radio'
});
$scope.organization_url = data.related.organization;

View File

@ -129,7 +129,8 @@ function UsersAdd($scope, $rootScope, $compile, $location, $log, $routeParams, U
form: form,
current_item: ($routeParams.organization_id !== undefined) ? $routeParams.organization_id : null,
list: OrganizationList,
field: 'organization'
field: 'organization',
input_type: 'radio'
});
if ($routeParams.organization_id) {

View File

@ -260,7 +260,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
scope: scope,
form: form,
list: CredentialList,
field: 'credential'
field: 'credential',
input_type: "radio"
});
if ($('#group_tabs .active a').text() === 'Source' && scope.source.value === 'ec2') {
callback = function(){ Wait('stop'); };

View File

@ -13,6 +13,7 @@
* hdr: <optional. modal dialog header>
* postAction: optional function to run after selection made,
* callback: optional label to $emit() on parent scope
* input_type: optional string that specifies whether lookup should have checkboxes or radio buttons. defaults to 'checkbox' --- added by JT 8/21/14
* })
*/
@ -31,6 +32,7 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
instructions = params.instructions,
postAction = params.postAction,
callback = params.callback,
input_type = (params.input_type) ? params.input_type: "checkbox",
defaultUrl, name, watchUrl;
if (params.url) {
@ -72,7 +74,8 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
mode: 'lookup',
id: 'lookup-modal-dialog',
scope: scope,
instructions: instructions
instructions: instructions,
input_type: input_type
});
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);

View File

@ -331,12 +331,12 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
}
if (options.mode === 'select' || options.mode === 'lookup') {
if(list.iterator==='organization'){
if(options.input_type==="radio"){ //added by JT so that lookup forms can be either radio inputs or check box inputs
html += "<td><input type=\"radio\" ng-model=\"" + list.iterator + ".checked\" name=\"check_{{" +
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator + "(" + list.iterator + ".id, true)\" ng-value=\"1\" " +
"ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";
}
else
else // its assumed that options.input_type = checkbox
html += "<td><input type=\"checkbox\" ng-model=\"" + list.iterator + ".checked\" name=\"check_{{" +
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator + "(" + list.iterator + ".id, true)\" ng-true-value=\"1\" " +
"ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";