Bigtop
view release on metacpan or search on metacpan
tenttemplates/input_boxes.ttc view on Meta::CPAN
[%#
Template for handling all manner of statements in TentMaker templates.
Expects these parameters:
method_group - the star in update_*_bool
name_prefix - beginning of input element name, this must
correspond to the TentMaker.pm update_* method.
Used only for multiples and pairs.
id_prefix - beginning of the input element id the AST ident
should be part of this
keyword_prefix - Used in front of the keyword when forming names
and the callback parameter. Include your own
trailing double colon.
single_value - initial value (singular) for all types
ignored if statement.multiple is set
values - initial values (plural) for text type when multiple
is set
key - the keyword of this statement (same as
statement.keyword below)
statement - hash of legal statements whose keys are below
keys in the statement hash:
type - pick from: text, textarea, select, boolean,
pair, or controlled_boolean
keyword - statement's keyword
default - what to use if boolean (or controlled_boolean)
value is undefined
multiple - indicates that more than one value or pair
can be given for the keyword (think comma
separated list). Only applies to types text,
select, and pair.
pair_labels - Headings to put over pair entry text boxes.
Only applies to type pair.
false - the text of the false value for controlled_boolean
if no value is given, 'undef' is used
true - similar to false, guess how they differ
options - an array of hashes required for type selectone
each hash has two keys: value and label
urgency - fills in the * in class='urgency_*' this is
used for color coding important fields
choose from 0, 1, 3, 5, or 10 which are (roughly)
white, lt. blue, green, orange, or red
values are double qouted to prevent clashes with single
quotes in the values
-%]
[%- full_key = "$keyword_prefix$key";
full_name = "$name_prefix$key";
full_id = "$id_prefix$key"; -%]
[% IF statement.type == 'textarea' %]
<textarea id='[% full_id %]'
cols='50' rows='6'
class='urgency_[% statement.urgency || 0 %]'
onblur='javascript:update_tree(
"[% method_group %]_text",
"[% full_key %]",
this.value
)'
>
[% single_value || '' %]
</textarea>
[% ELSIF statement.type == 'boolean' %]
<input type='checkbox'
value='[% full_name %]'
id='[% full_id %]'
class='urgency_[% statement.urgency || 0 %]'
[%- IF single_value || statement.default == 'true' -%]
checked='checked'
[%- END -%]
onchange='javascript:update_tree(
"[% method_group %]_bool",
"[% full_key %]",
this.checked[% IF statement.quick_label || statement.refresh %],
"",
"full_edit"[% END %]
)'
/>
[% ELSIF statement.type == 'controlled_boolean' %]
<input type='checkbox'
value='[% full_name %]'
id='[% full_id %]'
class='urgency_[% statement.urgency || 0 %]'
[%- IF single_value.defined -%]
[%- IF single_value == statement.true -%]
checked='checked'
[%- END -%]
[%- ELSIF statement.default == 'true' -%]
checked='checked'
[%- END -%]
onchange='javascript:update_tree(
"[% method_group %]_bool_controlled",
"[% full_key %]",
( run in 3.085 seconds using v1.01-cache-2.11-cpan-d8267643d1d )