1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Fix checkbox value assignment

This commit is contained in:
Joe Fiorini 2015-07-29 16:12:18 -04:00
parent a037063a22
commit c2d1e3865f
4 changed files with 15 additions and 24 deletions

View File

@ -1887,22 +1887,20 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
list = GroupList;
scope[list.name].forEach( function(row, i) {
if (row.id === id) {
if (row.checked === '0') {
scope[list.name][i].checked = '1';
if (row.checked) {
scope[list.name][i].success_class = 'success';
}
else {
scope[list.name][i].checked = '0';
scope[list.name][i].success_class = '';
}
} else {
scope[list.name][i].checked = '0';
scope[list.name][i].checked = 0;
scope[list.name][i].success_class = '';
}
});
// Check if any rows are checked
scope[list.name].forEach(function(row) {
if (row.checked === '1') {
if (row.checked) {
count++;
}
});
@ -1924,7 +1922,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
// check for group selection
$('#group-copy-ok-button').attr('disabled','disabled');
scope[list.name].every(function(row) {
if (row.checked === '1') {
if (row.checked === 1) {
$('#group-copy-ok-button').removeAttr('disabled');
return false;
}
@ -1945,7 +1943,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
}
else {
scope[list.name].every(function(row) {
if (row.checked === '1') {
if (row.checked === 1) {
target = row;
return false;
}

View File

@ -906,22 +906,20 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
list = GroupList;
scope[list.name].forEach( function(row, i) {
if (row.id === id) {
if (row.checked === '0') {
scope[list.name][i].checked = '1';
if (row.checked) {
scope[list.name][i].success_class = 'success';
}
else {
scope[list.name][i].checked = '0';
scope[list.name][i].success_class = '';
}
} else {
scope[list.name][i].checked = '0';
scope[list.name][i].checked = 0;
scope[list.name][i].success_class = '';
}
});
// Check if any rows are checked
scope[list.name].forEach(function(row) {
if (row.checked === '1') {
if (row.checked) {
count++;
}
});
@ -945,7 +943,7 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
}
else {
scope[list.name].every(function(row) {
if (row.checked === '1') {
if (row.checked === 1) {
target = row;
return false;
}

View File

@ -277,22 +277,20 @@ export default
var count = 0;
scope[list.name].forEach( function(row, i) {
if (row.id === id) {
if (row.checked === '0') {
scope[list.name][i].checked = '1';
if (row.checked) {
scope[list.name][i].success_class = 'success';
}
else {
scope[list.name][i].checked = '0';
scope[list.name][i].success_class = '';
}
} else {
scope[list.name][i].checked = '0';
scope[list.name][i].checked = 0;
scope[list.name][i].success_class = '';
}
});
// Check if any rows are checked
scope[list.name].forEach(function(row) {
if (row.checked === '1') {
if (row.checked) {
count++;
}
});

View File

@ -45,9 +45,8 @@ export default
var i, j, found;
for (i = 0; i < scope[list.name].length; i++) {
if (scope[list.name][i].id === id) {
if ((scope[list.name][i].checked === "0" && !ischeckbox) || (scope[list.name][i].checked === "0" && ischeckbox)) {
// select the row
scope[list.name][i].checked = '1';
var control = scope[list.name][i];
if (ischeckbox && control.checked) {
scope[list.name][i].success_class = 'success';
// add selected object to the array
found = false;
@ -60,9 +59,7 @@ export default
if (!found) {
selected.push(scope[list.name][i]);
}
} else {
// unselect the row
scope[list.name][i].checked = '0';
} else if (ischeckbox) {
scope[list.name][i].success_class = '';
// remove selected object from the array