All select pages now have clickable rows. The checkbox is still present and will e toggled along with row color. Fixed the typ-o on User select page.

This commit is contained in:
chouseknecht
2013-05-17 07:55:17 -04:00
parent 0f4a4b6cb9
commit 94ff36b62f
15 changed files with 152 additions and 61 deletions

View File

@@ -89,12 +89,22 @@ function AdminsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
} }
} }
scope.toggle_admin = function(idx) { scope.toggle_admin = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
} }
} }
} }

View File

@@ -119,16 +119,26 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
else { else {
ReturnToCaller(); ReturnToCaller();
} }
} }
scope.toggle_credential = function(idx) { scope.toggle_credential = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
}
} }
}
} }
CredentialsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'CredentialList', 'GenerateList', CredentialsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'CredentialList', 'GenerateList',

View File

@@ -120,12 +120,22 @@ function GroupsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
} }
} }
scope.toggle_group = function(idx) { scope.toggle_group = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
} }
} }

View File

@@ -117,16 +117,26 @@ function HostsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
else { else {
ReturnToCaller(1); ReturnToCaller(1);
} }
} }
scope.toggle_host = function(idx) { scope.toggle_host = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
}
} }
}
} }

View File

@@ -120,16 +120,26 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
else { else {
ReturnToCaller(); ReturnToCaller();
} }
} }
scope.toggle_inventory = function(idx) { scope.toggle_inventory = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
}
} }
}
} }
InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList', InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList',

View File

@@ -114,16 +114,26 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re
else { else {
ReturnToCaller(1); ReturnToCaller(1);
} }
} }
scope.toggle_credential = function(idx) { scope.toggle_job_template = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
}
} }
}
function postJob(data) { function postJob(data) {
// Once we have a credential and all required passwords, use this // Once we have a credential and all required passwords, use this

View File

@@ -116,14 +116,24 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
} }
} }
scope.toggle_project = function(idx) { scope.toggle_project = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
}
} }
}
} }
ProjectsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList', ProjectsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList',

View File

@@ -130,12 +130,22 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale
} }
} }
scope.toggle_team = function(idx) { scope.toggle_team = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
} }
} }
} }

View File

@@ -115,16 +115,26 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest,
else { else {
ReturnToCaller(); ReturnToCaller();
} }
} }
scope.toggle_user = function(idx) { scope.toggle_user = function(id) {
if (scope.selected.indexOf(idx) > -1) { if (scope.selected.indexOf(id) > -1) {
scope.selected.splice(scope.selected.indexOf(idx),1); scope.selected.splice(scope.selected.indexOf(id),1);
} }
else { else {
scope.selected.push(idx); scope.selected.push(id);
}
if (scope[list.iterator + "_" + id + "_class"] == "success") {
scope[list.iterator + "_" + id + "_class"] = "";
//$('input[name="check_' + id + '"]').checked = false;
document.getElementById('check_' + id).checked = false;
}
else {
scope[list.iterator + "_" + id + "_class"] = "success";
//$('input[name="check_' + id + '"]').checked = true;
document.getElementById('check_' + id).checked = true;
}
} }
}
} }
UsersList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'UserList', 'GenerateList', UsersList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'UserList', 'GenerateList',
@@ -135,7 +145,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams,
GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope) GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope)
{ {
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope. //scope.
// Inject dynamic view // Inject dynamic view
var defaultUrl = '/api/v1/organizations/'; var defaultUrl = '/api/v1/organizations/';

View File

@@ -14,7 +14,7 @@ angular.module('AdminListDefinition', [])
iterator: 'admin', iterator: 'admin',
selectTitle: 'Add Administrators', selectTitle: 'Add Administrators',
editTitle: 'Admins', editTitle: 'Admins',
selectInstructions: 'Click the Select checkbox next to each user to be added. Click the Finished button when done.', selectInstructions: 'Click on a row to select it. Click the Finished button when done.',
base: 'users', base: 'users',
fields: { fields: {

View File

@@ -14,7 +14,7 @@ angular.module('GroupListDefinition', [])
iterator: 'group', iterator: 'group',
selectTitle: 'Add Group', selectTitle: 'Add Group',
editTitle: 'Groups', editTitle: 'Groups',
selectInstructions: 'Check the Select checkbox next to each group to be added, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new group.', selectInstructions: 'Click on a row to select it, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new row.',
fields: { fields: {
name: { name: {

View File

@@ -13,7 +13,7 @@ angular.module('HostListDefinition', [])
name: 'hosts', name: 'hosts',
iterator: 'host', iterator: 'host',
selectTitle: 'Add Host', selectTitle: 'Add Host',
selectInstructions: 'Check the Select checkbox next to each host to be added, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new host.', selectInstructions: 'Click on a row to select it, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new row.',
editTitle: 'Hosts', editTitle: 'Hosts',
fields: { fields: {

View File

@@ -14,7 +14,7 @@ angular.module('InventoriesListDefinition', [])
iterator: 'inventory', iterator: 'inventory',
selectTitle: 'Add Inventories', selectTitle: 'Add Inventories',
editTitle: 'Inventories', editTitle: 'Inventories',
selectInstructions: 'Check the Select checkbox next to each inventory to be added, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new inventory.', selectInstructions: 'Click on a row to select it, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new row.',
fields: { fields: {
name: { name: {

View File

@@ -14,7 +14,7 @@ angular.module('ProjectsListDefinition', [])
iterator: 'project', iterator: 'project',
selectTitle: 'Add Project', selectTitle: 'Add Project',
editTitle: '{{ name }}', editTitle: '{{ name }}',
selectInstructions: 'Check the Select checkbox next to each project to be added, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new project.', selectInstructions: 'Click on a row to select it, and click Finished when done. Use the green <i class=\"icon-plus\"></i> button to create a new row.',
fields: { fields: {
name: { name: {

View File

@@ -169,9 +169,9 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
// table body // table body
html += "<tbody>\n"; html += "<tbody>\n";
html += "<tr "; html += "<tr ";
html += (options.mode == 'lookup') ? "ng-class=\"" + list.iterator + "_\{\{ " + list.iterator + ".id \}\}_class\" " : ""; html += (options.mode == 'lookup' || options.mode == 'select') ? "ng-class=\"" + list.iterator + "_\{\{ " + list.iterator + ".id \}\}_class\" " : "";
html += "class=\"" + list.iterator + "_class\" ng-repeat=\"" + list.iterator + " in " + list.name + "\""; html += "class=\"" + list.iterator + "_class\" ng-repeat=\"" + list.iterator + " in " + list.name + "\"";
html += (options.mode == 'lookup') ? " ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }})\"" : ""; html += (options.mode == 'lookup' || options.mode == 'select') ? " ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }})\"" : "";
html += ">\n"; html += ">\n";
html += "<td class=\"index-column\">{{ $index + (" + list.iterator + "Page * " + list.iterator + "PageSize) + 1 }}.</td>\n"; html += "<td class=\"index-column\">{{ $index + (" + list.iterator + "Page * " + list.iterator + "PageSize) + 1 }}.</td>\n";
var cnt = 2; var cnt = 2;
@@ -180,27 +180,28 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
cnt++; cnt++;
if (! list.fields[fld].ngBind) { if (! list.fields[fld].ngBind) {
html += "<td class=\"" + fld + "-column\">"; html += "<td class=\"" + fld + "-column\">";
if (list.fields[fld].key) { if (list.fields[fld].key && options.mode != 'lookup') {
html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\">"; html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\">";
} }
html += "{{" + list.iterator + "." + fld + "}}"; html += "{{" + list.iterator + "." + fld + "}}";
html += (list.fields[fld].key) ? "</a>" : ""; html += (list.fields[fld].key && options.mode != 'lookup') ? "</a>" : "";
html += "</td>\n"; html += "</td>\n";
} }
else { else {
html += "<td class=\"" + fld + "-column\">"; html += "<td class=\"" + fld + "-column\">";
if (list.fields[fld].key) { if (list.fields[fld].key && options.mode != 'lookup') {
html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\">"; html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\">";
} }
html += "{{ " + list.fields[fld].ngBind + " }}"; html += "{{ " + list.fields[fld].ngBind + " }}";
html += (list.fields[fld].key) ? "</a>" : ""; html += (list.fields[fld].key && options.mode != 'lookup') ? "</a>" : "";
html += "</td>\n"; html += "</td>\n";
} }
} }
if (options.mode == 'select' ) { if (options.mode == 'select' ) {
html += "<td><input type=\"checkbox\" name=\"select\" ng-click=\"toggle_" + list.iterator + html += "<td><input type=\"checkbox\" name=\"check_{{" + list.iterator + ".id}}\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";
"({{ " + list.iterator + ".id }})\" \></td>"; //ng-click=\"toggle_" + list.iterator +
// "({{ " + list.iterator + ".id }}, true)\"
} }
else if (options.mode == 'edit') { else if (options.mode == 'edit') {
// Row level actions // Row level actions