X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fcheckbox-foot.html;h=f33a87467b4800de24f20867ae4d67e68c48442f;hp=c4700942531af93feb507c8bd4f3f83e7fb91ea5;hb=HEAD;hpb=5f10fda22d066f3e730db11b7c26938547014631 diff --git a/httemplate/search/elements/checkbox-foot.html b/httemplate/search/elements/checkbox-foot.html index c47009425..f33a87467 100644 --- a/httemplate/search/elements/checkbox-foot.html +++ b/httemplate/search/elements/checkbox-foot.html @@ -4,13 +4,14 @@ html_foot => include('elements/checkbox-foot.html', actions => [ { label => 'Edit selected packages', - action => 'popup_package_edit()', + onclick => 'popup_package_edit()', }, { submit => 'Delete selected packages', confirm => 'Really delete these packages?' }, ], filter => '.name = "pkgpart"', # see below + minboxes => 2, #will remove checkboxes if there aren't at least this many ), &> @@ -49,7 +50,7 @@ false.
% foreach my $action (@$actions) { % if ( $action->{onclick} ) { -{name} %> onclick="<% $opt{onclick} %>"\ +{name} %> onclick="<% $action->{onclick} %>"\ VALUE="<% $action->{label} |h%>"> % } elsif ( $action->{submit} ) { {name} %> <% $action->{confirm} %>\ @@ -67,6 +68,14 @@ for (var i = 0; i < inputs.length; i++) { } } %# avoid the need for "$areboxes" late-evaluation hackery +% if ($opt{'minboxes'}) { +if ( checkboxes.length < <% $opt{'minboxes'} %> ) { + for (i = 0; i < checkboxes.length; i++) { + checkboxes[i].parentNode.removeChild(checkboxes[i]); + } + checkboxes = []; +} +% } if ( checkboxes.length == 0 ) { document.getElementById('checkbox_footer').style.display = 'none'; }