diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-01-11 13:51:03 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-01-11 13:51:03 -0500 |
commit | 85d29bf517efab756aec40bee067ced4efa5075d (patch) | |
tree | 00da387365eb650ee5490734821b63437c793b62 /src/usr/local/www/jquery | |
parent | 7faea45ee8dd2d8863e3ae678721ecc0e0abf6d2 (diff) | |
download | pfsense-85d29bf517efab756aec40bee067ced4efa5075d.zip pfsense-85d29bf517efab756aec40bee067ced4efa5075d.tar.gz |
Allow thee use of multiple infoblock on a page
Diffstat (limited to 'src/usr/local/www/jquery')
-rw-r--r-- | src/usr/local/www/jquery/pfSenseHelpers.js | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js index 61c6793..e2a871e 100644 --- a/src/usr/local/www/jquery/pfSenseHelpers.js +++ b/src/usr/local/www/jquery/pfSenseHelpers.js @@ -384,23 +384,36 @@ $('[id^=delete]').click(function(event) { alert('You may not delete the last row!'); }); -// "More information" handlers +// "More information" handlers -------------------------------------------------------------------- // If there is an infoblock, automatically add an info icon that toggles its display -if($('.infoblock,.infoblock_open,#infoblock').length != 0) { - $('.infoblock,.infoblock_open,#infoblock').before('<i class="fa fa-info-circle icon-pointer" style="color: #337AB7;; font-size:20px; margin-left: 10px; margin-bottom: 10px;" id="showinfo" title="More information"></i>'); +// If there is n=more than one infoblock on a page, each must use a unique class suffic. e.g.: infoblock_01 or infoblock_open_19 - // and remove the 'X' button from the last text box (Which we assume to be the infoblock) - $('.close :last').remove(); -} +$('[class^="infoblock"], [class^="infoblock_open"]').each(function() { + var classname = $(this).attr("class"); + var sfx = ''; + + if (classname.indexOf("infoblock_open")) { + sfx = classname.substr(15); + $(this).hide(); + } else { + sfx = "_" + classname.substr(10); + } + + $(this).before('<i class="fa fa-info-circle icon-pointer" style="color: #337AB7; font-size:20px; margin-left: 10px; margin-bottom: 10px;" id="showinfo' + sfx + '" title="More information"></i>'); +}); // Hide information on page load -$('.infoblock,#infoblock').hide(); +//$('.infoblock,#infoblock').hide(); // Show the help on clicking the info icon -$('#showinfo').click(function() { - $('.infoblock,.infoblock_open,#infoblock').toggle(); +$('[id^="showinfo"]').click(function() { + var id = $(this).attr("id"); + var target = "infoblock" + id.substr(8); + + $('.' + target).toggle(); }); +// ------------------------------------------------------------------------------------------------ // Put a dummy row into any empty table to keep IE happy $('tbody').each(function(){ |