fix template parser and attachments fields

This commit is contained in:
Doug Bell 2011-07-06 19:16:01 -05:00
parent cc26d97805
commit d15891dbb9
2 changed files with 33 additions and 44 deletions

View file

@ -163,7 +163,8 @@ sub toHtml {
# Table headers
$output .= '<table id="' . $self->get( 'id' ) . '"><thead><tr>';
for my $field ( @{ $self->get('fields') } ) {
$output .= '<th>' . $field->{label} . '</th>';
my $label = ref $field->{label} eq 'ARRAY' ? $i18n->get(@{$field->{label}}) : $field->{label};
$output .= '<th>' . $label . '</th>';
}
$output .= '<th>&nbsp;</th>'; # Extra column for buttons
@ -190,6 +191,10 @@ sub toHtml {
for my $i ( 0 .. $opts-1 ) {
my $optValue = $field->{options}[$i*2];
my $optLabel = $field->{options}[$i*2+1];
# If the label is an arrayref, get the i18n value
if ( ref $optLabel eq 'ARRAY' ) {
$optLabel = $i18n->get(@{$optLabel});
}
$fieldHtml .= '<option value="' . $optValue . '">' . $optLabel . '</option>';
}
$fieldHtml .= '</select>';