mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 09:57:35 -02:30
made organization lookup use radio buttons for card 74 on the tower 2.1 board
This commit is contained in:
@@ -48,14 +48,14 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||||
|
|
||||||
watchUrl = (/\/$/.test(defaultUrl)) ? defaultUrl + '?' : defaultUrl + '&';
|
watchUrl = (/\/$/.test(defaultUrl)) ? defaultUrl + '?' : defaultUrl + '&';
|
||||||
watchUrl += form.fields[field].sourceField + '__' + 'iexact=:value';
|
watchUrl += form.fields[field].sourceField + '__' + 'iexact=:value';
|
||||||
|
|
||||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url', watchUrl);
|
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url', watchUrl);
|
||||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-source', field);
|
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-source', field);
|
||||||
|
|
||||||
|
|
||||||
parent_scope['lookUp' + name] = function () {
|
parent_scope['lookUp' + name] = function () {
|
||||||
|
|
||||||
var master = {},
|
var master = {},
|
||||||
@@ -78,7 +78,7 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
|
|||||||
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||||
hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
||||||
|
|
||||||
// Show pop-up
|
// Show pop-up
|
||||||
buttons = [{
|
buttons = [{
|
||||||
label: "Cancel",
|
label: "Cancel",
|
||||||
icon: "fa-times",
|
icon: "fa-times",
|
||||||
@@ -155,7 +155,7 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List generator creates the list, resetting it and losing the previously selected value.
|
// List generator creates the list, resetting it and losing the previously selected value.
|
||||||
// If the selected value is in the current set, find it and mark selected.
|
// If the selected value is in the current set, find it and mark selected.
|
||||||
if (!Empty(parent_scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField])) {
|
if (!Empty(parent_scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField])) {
|
||||||
scope[list.name].forEach(function(elem) {
|
scope[list.name].forEach(function(elem) {
|
||||||
@@ -178,7 +178,7 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
|
|||||||
scope.selectAction = function () {
|
scope.selectAction = function () {
|
||||||
var i, found = false;
|
var i, found = false;
|
||||||
for (i = 0; i < scope[list.name].length; i++) {
|
for (i = 0; i < scope[list.name].length; i++) {
|
||||||
if (scope[list.name][i].checked === '1') {
|
if (scope[list.name][i].checked === '1' || scope[list.name][i].checked===1) {
|
||||||
found = true;
|
found = true;
|
||||||
parent_scope[field] = scope[list.name][i].id;
|
parent_scope[field] = scope[list.name][i].id;
|
||||||
if (parent_scope[form.name + '_form'] && form.fields[field] && form.fields[field].sourceModel) {
|
if (parent_scope[form.name + '_form'] && form.fields[field] && form.fields[field].sourceModel) {
|
||||||
|
|||||||
@@ -331,7 +331,13 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options.mode === 'select' || options.mode === 'lookup') {
|
if (options.mode === 'select' || options.mode === 'lookup') {
|
||||||
html += "<td><input type=\"checkbox\" ng-model=\"" + list.iterator + ".checked\" name=\"check_{{" +
|
if(list.iterator==='organization'){
|
||||||
|
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
|
||||||
|
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\" " +
|
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>";
|
"ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";
|
||||||
} else if ((options.mode === 'edit' || options.mode === 'summary') && list.fieldActions) {
|
} else if ((options.mode === 'edit' || options.mode === 'summary') && list.fieldActions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user