From 7b3c18f90c6677884bd39d29f011ea59a257184b Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 19 Feb 2013 14:34:28 -0800 Subject: better UI for package report classes, #13057 --- httemplate/elements/checkbox-tristate.html | 78 ++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 httemplate/elements/checkbox-tristate.html (limited to 'httemplate/elements') diff --git a/httemplate/elements/checkbox-tristate.html b/httemplate/elements/checkbox-tristate.html new file mode 100644 index 000000000..4c26ed74e --- /dev/null +++ b/httemplate/elements/checkbox-tristate.html @@ -0,0 +1,78 @@ +<%doc> +A tristate checkbox (with three values: true, false, and null). +Internally, this creates a checkbox, coupled via javascript to a hidden +field that actually contains the value. For now, the only values these +can have are 1, 0, and empty. Clicking the checkbox cycles between them. + +<%shared> +my $init = 0; + +% if ( !$init ) { +% $init = 1; + +% } # end of $init + + +<%init> + +my %opt = @_; + +# might be useful but I'm not implementing it yet +#my $onchange = $opt{'onchange'} +# ? 'onChange="'. $opt{'onchange'}. '(this)"' +# : ''; + +$opt{'id'} ||= 'hidden_'.$opt{'field'}; +my $curr_value = $opt{curr_value}; +$curr_value = undef + unless $curr_value eq '0' or $curr_value eq '1'; + -- cgit v1.2.1