From 62b53201e23ba5f5a1b459bc076ba8eb3a5b3ac1 Mon Sep 17 00:00:00 2001 From: Endi S. Dewata Date: Thu, 10 Feb 2011 16:10:53 -0600 Subject: [PATCH] Added expand/collapse all. A link has been added into the details page to expand/collapse all sections. Previously each section's
container is identified using a long ID. It is now identified using the section name. --- install/ui/details.js | 100 +++++++++++++++++++++++++++++++++++------------ install/ui/dialog.js | 4 +- install/ui/hbacrule.js | 4 +- install/ui/sudorule.js | 4 +- 4 files changed, 78 insertions(+), 34 deletions(-) diff --git a/install/ui/details.js b/install/ui/details.js index b62f049419b819def729bc75d89b1d9a6aa999e1..a9741690493b0aa75d0dd5c70e619b3ab7e4505b 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -348,18 +348,6 @@ IPA.details_facet = function(spec) { } }; - that.get_section_header_prefix = function(visible) { - if (visible) { - return ''; - } else { - return ''; - } - }; - function create(container) { container.attr('title', that.entity_name); @@ -373,6 +361,21 @@ IPA.details_facet = function(spec) { 'class': 'content' }).appendTo(container); + $('', { + name: 'expand_all', + href: 'expand_all', + text: 'Expand All', + style: 'display: none;' + }).appendTo(details); + + $('', { + name: 'collapse_all', + href: 'collapse_all', + text: 'Collapse All' + }).appendTo(details); + + details.append('
'); + var action_panel = that.get_action_panel(); var ul = $('ul', action_panel); @@ -392,14 +395,22 @@ IPA.details_facet = function(spec) { for (var i = 0; i < that.sections.length; ++i) { var section = that.sections[i]; - $('

', { + var header = $('

', { name: section.name, - title: section.label, - html: that.get_section_header_prefix(true) + ' ' + section.label + title: section.label }).appendTo(details); + var icon = $('', { + name: 'icon', + 'class': 'ui-icon section-expand '+IPA.expand_icon + }).appendTo(header); + + header.append(' '); + + header.append(section.label); + var div = $('
', { - 'id': that.entity_name+'-'+that.name+'-'+section.name, + name: section.name, 'class': 'details-section' }).appendTo(details); @@ -437,26 +448,65 @@ IPA.details_facet = function(spec) { }); button.replaceWith(that.update_button); + var details = $('div.content', that.container); + + var expand_all = $('a[name=expand_all]', details); + expand_all.click(function() { + expand_all.css('display', 'none'); + collapse_all.css('display', 'inline'); + + for (var i=0; i', { - 'id': that.entity_name+'-'+that.name+'-'+section.name, + name: section.name, 'class': 'details-section' }).appendTo(that.container); @@ -160,7 +160,7 @@ IPA.dialog = function(spec) { for (var j=0; j