From 255dead52135a1e0b759347f63ac1c39c55a2f7d Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Wed, 8 Jan 2014 17:11:36 +0000 Subject: [PATCH] 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. --- awx/ui/static/js/controllers/JobEvents.js | 2 +- awx/ui/static/js/helpers/Children.js | 6 +++--- awx/ui/static/less/ansible-ui.less | 17 +++++++---------- awx/ui/static/lib/ansible/InventoryTree.js | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/awx/ui/static/js/controllers/JobEvents.js b/awx/ui/static/js/controllers/JobEvents.js index 7a60e28863..64bf87bff5 100644 --- a/awx/ui/static/js/controllers/JobEvents.js +++ b/awx/ui/static/js/controllers/JobEvents.js @@ -132,7 +132,7 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest, set[i].event_display = set[i].event_display.replace(/^\u00a0*/g,''); if (set[i].event_level < 3 ) { 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'; } else { diff --git a/awx/ui/static/js/helpers/Children.js b/awx/ui/static/js/helpers/Children.js index 679ebe69f9..de102d835a 100644 --- a/awx/ui/static/js/helpers/Children.js +++ b/awx/ui/static/js/helpers/Children.js @@ -20,7 +20,7 @@ angular.module('ChildrenHelper', ['RestServices', 'Utilities']) var set = scope[list.name]; // set is now a pointer to scope[list.name] 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++) { if (set[i].parent == set[node].id) { set[i]['show'] = true; @@ -32,7 +32,7 @@ angular.module('ChildrenHelper', ['RestServices', 'Utilities']) } 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++) { if (set[i].parent == set[node].id) { set[i]['show'] = false; @@ -53,7 +53,7 @@ angular.module('ChildrenHelper', ['RestServices', 'Utilities']) } } // 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(clicked); } diff --git a/awx/ui/static/less/ansible-ui.less b/awx/ui/static/less/ansible-ui.less index 7d8204c523..20909be475 100644 --- a/awx/ui/static/less/ansible-ui.less +++ b/awx/ui/static/less/ansible-ui.less @@ -1003,8 +1003,13 @@ input[type="checkbox"].checkbox-no-label { font-weight: bold; } -.inv-group-toggle { - margin-right: 3px; +.node-toggle { + /* also used on job evetns */ + float: none; + padding-top: 3px; + padding-left: 0; + margin-right: 5px; + margin-left: 0; } .disabled { @@ -1062,14 +1067,6 @@ a.btn-disabled:hover { /* 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 { padding-top: 0; margin-right: 0; diff --git a/awx/ui/static/lib/ansible/InventoryTree.js b/awx/ui/static/lib/ansible/InventoryTree.js index 55b79d3af8..695c3d7d61 100644 --- a/awx/ui/static/lib/ansible/InventoryTree.js +++ b/awx/ui/static/lib/ansible/InventoryTree.js @@ -209,7 +209,7 @@ angular.module('InventoryTree', ['Utilities', 'RestServices', 'GroupsHelper']) source: sorted[i].summary_fields.inventory_source.source, group_id: sorted[i].id, 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 + ')', related: { children: (sorted[i].children.length > 0) ? sorted[i].related.children : '',