Changeset 73 in text-formbuilder for trunk/lib


Ignore:
Timestamp:
03/16/05 13:55:22 (20 years ago)
Author:
peichman
Message:

updated Changes file
can have a hint comment on group fields (displayed after all the subfields)
'#' comments can appear at the end of lines in group field lines

Location:
trunk/lib/Text
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Text/FormBuilder.pm

    r72 r73  
    177177                        $$field{name} = "$$_[1]{name}_$$field{name}";                 
    178178                    } 
    179                     $_ = [ 'group', { label => $$_[1]{label} || ucfirst(join(' ',split('_',$$_[1]{name}))), group => \@fields } ]; 
     179                    $_ = [ 
     180                        'group', 
     181                        { 
     182                            label => $$_[1]{label} || ucfirst(join(' ',split('_',$$_[1]{name}))), 
     183                            comment => $$_[1]{comment}, 
     184                            group => \@fields, 
     185                        }, 
     186                    ]; 
    180187                } 
    181188            } 
     
    526533                # mark invalid fields 
    527534                if ($$_{invalid}) { 
    528                     $OUT .= "<td>$$_{field} $$_{comment} ] . $msg_invalid . q[</td>"; 
     535                    $OUT .= qq[<td>$$_{field} <span class="comment">$$_{comment}</span> ] . $msg_invalid . q[</td>]; 
    529536                } else { 
    530                     $OUT .= qq[<td>$$_{field} $$_{comment}</td>]; 
     537                    $OUT .= qq[<td>$$_{field} <span class="comment">$$_{comment}</span></td>]; 
    531538                } 
    532539                 
     
    546553                $OUT .= " ] . $msg_invalid . q[" if grep { $$_{invalid} } @group_fields; 
    547554                 
    548                 $OUT .= qq[    </span></td>\n]; 
     555                $OUT .= qq[ <span class="comment">$$line[1]{comment}</span></span></td>\n]; 
    549556                $OUT .= qq[  </tr>\n]; 
    550557            }    
     
    11801187 
    11811188You can also use groups in normal field lines: 
    1182      
     1189 
    11831190    birthday|Your birthday:DATE 
    11841191 
    11851192The only (currently) supported pieces of a fieldspec that may be used with a 
    1186 group in this notation are name and label. 
     1193group in this notation are name, label, and hint. 
    11871194 
    11881195=head2 Comments 
     
    11901197    # comment ... 
    11911198 
    1192 Any line beginning with a C<#> is considered a comment. 
     1199Any line beginning with a C<#> is considered a comment. Comments can also appear 
     1200after any field line. They I<cannot> appear between items in a C<!list>, or on 
     1201the same line as any of the directives. 
    11931202 
    11941203=head1 TODO 
     
    12071216reset button 
    12081217 
    1209 Allow comments on group fields (rendered after the all the fields) 
     1218Set FB constructor options directly in the formspec (via a C<!fb> or similar 
     1219directive). The major issue here would be what format to use to allow for 
     1220array/hash refs. 
    12101221 
    12111222Pieces that wouldn't make sense in a group field: size, row/col, options, 
  • trunk/lib/Text/FormBuilder/grammar

    r68 r73  
    152152group_name: /%[A-Z_]+/ 
    153153 
    154 field_group: name label(?) group_type 
    155     {  
     154field_group: name label(?) hint(?) group_type comment(?) 
     155    { 
     156        warn "[$thisline] comment = $item{'hint(?)'}[0]\n" if $item{'hint(?)'}[0]; 
    156157        #warn "[$thisline] field $item{name} is $item{group_type}\n"; 
    157         push @lines, [ 'group', { name => $item{name}, label => $item{'label(?)'}[0], group => $item{group_type} } ]; 
     158        push @lines, [ 'group', { 
     159            name    => $item{name}, 
     160            label   => $item{'label(?)'}[0], 
     161            comment => $item{'hint(?)'}[0], 
     162            group   => $item{group_type}, 
     163        } ]; 
    158164    } 
    159165 
Note: See TracChangeset for help on using the changeset viewer.