Inventory refactoring: fixed toggle icon styling. Now job events and inventory group trees use .node-toggle to style collapse/expand icon. Fixed regex issue in Children helper.

This commit is contained in:
Chris Houseknecht
2014-01-08 17:11:36 +00:00
parent e581650dbb
commit 255dead521
4 changed files with 12 additions and 15 deletions

View File

@@ -132,7 +132,7 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
set[i].event_display = set[i].event_display.replace(/^\u00a0*/g,''); set[i].event_display = set[i].event_display.replace(/^\u00a0*/g,'');
if (set[i].event_level < 3 ) { if (set[i].event_level < 3 ) {
set[i]['ngclick'] = "toggleChildren(" + set[i].id + ", \"" + set[i].related.children + "\")"; set[i]['ngclick'] = "toggleChildren(" + set[i].id + ", \"" + set[i].related.children + "\")";
set[i]['ngicon'] = 'fa fa-minus-square-o'; set[i]['ngicon'] = 'fa fa-minus-square-o node-toggle';
set[i]['class'] = 'parentNode'; set[i]['class'] = 'parentNode';
} }
else { else {

View File

@@ -20,7 +20,7 @@ angular.module('ChildrenHelper', ['RestServices', 'Utilities'])
var set = scope[list.name]; // set is now a pointer to scope[list.name] var set = scope[list.name]; // set is now a pointer to scope[list.name]
function expand(node) { function expand(node) {
set[node]['ngicon'] = 'fa fa-minus-square-o'; set[node]['ngicon'] = 'fa fa-minus-square-o node-toggle';
for (var i = node + 1; i < set.length; i++) { for (var i = node + 1; i < set.length; i++) {
if (set[i].parent == set[node].id) { if (set[i].parent == set[node].id) {
set[i]['show'] = true; set[i]['show'] = true;
@@ -32,7 +32,7 @@ angular.module('ChildrenHelper', ['RestServices', 'Utilities'])
} }
function collapse(node) { function collapse(node) {
set[node]['ngicon'] = 'fa fa-plus-square-o'; set[node]['ngicon'] = 'fa fa-plus-square-o node-toggle';
for (var i = node + 1; i < set.length; i++) { for (var i = node + 1; i < set.length; i++) {
if (set[i].parent == set[node].id) { if (set[i].parent == set[node].id) {
set[i]['show'] = false; set[i]['show'] = false;
@@ -53,7 +53,7 @@ angular.module('ChildrenHelper', ['RestServices', 'Utilities'])
} }
} }
// Expand or collapse children based on clicked element's icon // Expand or collapse children based on clicked element's icon
if (set[clicked]['ngicon'] == 'fa fa-plus-square-o') { if (/plus-square-o/.test(set[clicked]['ngicon'])) {
// Expand: lookup and display children // Expand: lookup and display children
expand(clicked); expand(clicked);
} }

View File

@@ -1003,8 +1003,13 @@ input[type="checkbox"].checkbox-no-label {
font-weight: bold; font-weight: bold;
} }
.inv-group-toggle { .node-toggle {
margin-right: 3px; /* also used on job evetns */
float: none;
padding-top: 3px;
padding-left: 0;
margin-right: 5px;
margin-left: 0;
} }
.disabled { .disabled {
@@ -1062,14 +1067,6 @@ a.btn-disabled:hover {
/* job_events syles */ /* job_events syles */
#jobevents_table tr td i {
float: none;
padding-top: 3px;
padding-left: 0;
margin-right: 5px;
margin-left: 0;
}
#jobevents_table .actions i { #jobevents_table .actions i {
padding-top: 0; padding-top: 0;
margin-right: 0; margin-right: 0;

View File

@@ -209,7 +209,7 @@ angular.module('InventoryTree', ['Utilities', 'RestServices', 'GroupsHelper'])
source: sorted[i].summary_fields.inventory_source.source, source: sorted[i].summary_fields.inventory_source.source,
group_id: sorted[i].id, group_id: sorted[i].id,
event_level: level, event_level: level,
ngicon: (sorted[i].children.length > 0) ? 'fa fa-minus-square-o inv-group-toggle' : null, ngicon: (sorted[i].children.length > 0) ? 'fa fa-minus-square-o node-toggle' : null,
ngclick: 'toggle(' + id + ')', ngclick: 'toggle(' + id + ')',
related: { related: {
children: (sorted[i].children.length > 0) ? sorted[i].related.children : '', children: (sorted[i].children.length > 0) ? sorted[i].related.children : '',