Changes between Version 23 and Version 24 of DeveloperGuidelines/Themes


Ignore:
Timestamp:
01/15/15 03:41:40 (10 years ago)
Author:
svineet
Comment:

add formstyle docs

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Themes

    v23 v24  
    4343Note that all CSS files should be able to find their images both in debug mode & when compressed into eden.min.css - this is normally done by having the files at the same depth in the tree.
    4444
     45You can also customize the styling and classes used in forms using formstyle. Add this to config.py (in config() function if using the new template location):
     46
     47{{{
     48settings.ui.formstyle = "your_formstyle"
     49}}}
     50
     51Formstyles can be: table2cols, table3cols, divs, bootstrap, foundation and many more. You can find these functions in web2py/gluon/sqlhtml.py with the names "formstyle_<something here>". You can refer to these to implement custom functions. The settings.ui.formstyle can also take a function. And example function to use Semantic UI form styling:
     52
     53{{{
     54def semantic_formstyle(id, label, controls, help):
     55    """ divs only """
     56    _help = DIV(help, _class='w2p_fc')
     57    _controls = controls
     58    _label = LABEL(label)
     59    return DIV(
     60        _label,
     61        _controls,
     62        _help,
     63        _id=id,
     64        _class="ui field"
     65        )
     66}}}
     67
     68
    4569NB Production sites who wish to compile their code either need to hardcode the theme name in their {{{views/layout.html}}} or upgrade to Web2Py version: 2.00.0 (2012-06-17 23:36:32), or newer.
    4670