Changeset 72 in text-formbuilder for trunk


Ignore:
Timestamp:
03/16/05 11:47:57 (20 years ago)
Author:
peichman
Message:

addded an external_css option to include external stylesheets

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r66 r72  
    55    * added support for limited growth 'growable' fields 
    66    * allow end of field line comments 
     7    * addded an external_css option to include external stylesheets 
    78     
    890.09 - 10 Mar 2005 
  • trunk/lib/Text/FormBuilder.pm

    r71 r72  
    106106    #   CSS Hint: to get multiple sections to all line up their fields, 
    107107    #   set a standard width for th.label 
     108    # external_css: scalar for a single external stylesheet; array for 
     109    #   multiple sheets; prepended to the beginning of the CSS as @import 
     110    #   statetments 
    108111    my $css; 
    109112    $css = $options{css} || $DEFAULT_CSS; 
     113    if ($options{external_css}) { 
     114        my $ref = ref $options{external_css}; 
     115        if ($ref eq 'ARRAY') { 
     116            # loop over the list of external sheets 
     117            my $external_sheets = join("\n", map { "\@import url($_);" } @{ $options{external_css} }); 
     118            $css = "$external_sheets\n$css"; 
     119        } elsif ($ref) { 
     120            croak '[' . (caller(0))[3] . "] Don't know how to handle $ref reference as an argument to external_css"; 
     121        } else { 
     122            $css = "\@import url($options{external_css});\n$css"; 
     123        } 
     124    } 
    110125    $css .= $options{extra_css} if $options{extra_css}; 
    111126     
     
    721736    css => '@import(my_external_stylesheet.css);' 
    722737 
     738=item C<external_css> 
     739 
     740If you want to use multiple external stylesheets, or an external stylesheet 
     741in conojunction with the default styles, use the C<external_css> option: 
     742 
     743    # single external sheet 
     744    external_css => 'my_styles.css' 
     745     
     746    # mutliple sheets 
     747    external_css => [ 
     748        'my_style_A.css', 
     749        'my_style_B.css', 
     750    ] 
     751 
    723752=item C<messages> 
    724753 
     
    792821    $ perl -MText::FormBuilder -e"Text::FormBuilder->parse('formspec.txt')->write_module('My::Form')" 
    793822 
    794 And then, in your CGI script, use the new module: 
     823B<FIXME> And then, in your CGI script, use the new module: 
    795824 
    796825    #!/usr/bin/perl -w 
     
    11691198Document use of the parser as a standalone module 
    11701199 
     1200Make sure that the docs match the generated code. 
     1201 
    11711202Better tests! 
    11721203 
     
    11841215 
    11851216=head2 Code generation/Templates 
    1186  
    1187 Alternative format using C<< <fieldset> >> tags instead of C<< <h2> >> 
    1188 section headers 
    1189  
    1190 Make the generated modules into subclasses of CGI::FormBuilder 
    11911217 
    11921218Revise the generated form constructing code to use the C<fieldopts> 
Note: See TracChangeset for help on using the changeset viewer.