From d5d5836c4f94e70f5f4ddf1df8ac8bb6e684202c Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Tue, 1 Dec 2015 09:41:13 -0500 Subject: Experimental changes to Form_Section() to allow the panel to be made collapsable in the same way that dashboard widgets are. Currently used on diag_logs_filter.php ONLY --- src/usr/local/www/jquery/pfSenseHelpers.js | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/usr/local/www/jquery') diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js index 3408008..aac6def 100644 --- a/src/usr/local/www/jquery/pfSenseHelpers.js +++ b/src/usr/local/www/jquery/pfSenseHelpers.js @@ -381,3 +381,37 @@ $('tbody').each(function(){ }); $('tbody:empty').html(""); + + // Hide configuration button for panels without configuration + $('.container .panel-heading a.config').each(function (idx, el){ + var config = $(el).parents('.panel').children('.panel-footer'); + if (config.length == 1) + $(el).removeClass('hidden'); + }); + + // Initial state & toggle icons of collapsed panel + $('.container .panel-heading a[data-toggle="collapse"]').each(function (idx, el){ + var body = $(el).parents('.panel').children('.panel-body') + var isOpen = body.hasClass('in'); + + $(el).children('i').toggleClass('fa-plus-circle', !isOpen); + $(el).children('i').toggleClass('fa-minus-circle', isOpen); + + body.on('shown.bs.collapse', function(){ + $(el).children('i').toggleClass('fa-minus-circle', true); + $(el).children('i').toggleClass('fa-plus-circle', false); + + if($(el).closest('a').attr('name') != 'widgets-available') { + updateWidgets(); + } + }); + + body.on('hidden.bs.collapse', function(){ + $(el).children('i').toggleClass('fa-minus-circle', false); + $(el).children('i').toggleClass('fa-plus-circle', true); + + if($(el).closest('a').attr('name') != 'widgets-available') { + updateWidgets(); + } + }); + }); \ No newline at end of file -- cgit v1.1