Changes between Version 7 and Version 8 of S3/S3Summary


Ignore:
Timestamp:
07/31/14 13:40:42 (7 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3/S3Summary

    v7 v8  
    3333== Configuration ==
    3434
     35The summary page configuration is a deployment setting:
     36
     37{{{#!python
     38settings.ui.summary = [...]
     39}}}
     40
     41It takes a list of section configurations as value, or None.
     42
     43The deployment setting can be overridden per resource:
     44{{{#!python
     45s3db.configure(tablename, summary = [...])
     46}}}
     47
     48A useful technique is to extend the deployment settings for a particular resource as needed:
     49{{{#!python
     50# Get the default configuration
     51summary = list(current.deployment_settings.get_ui_summary() or [])
     52# Extend with resource-specific sections
     53summary.extend([...])
     54s3db.configure(tablename, summary = summary)
     55}}}
     56
     57=== Sections Configuration ===
     58
     59Each section configuration is a dict:
     60{{{#!python
     61settings.ui.summary = [{"name": "table",    # the section name, must be unique
     62                        "label": "Table",   # the section label, will automatically be translated
     63                        "common": False,    # show this section on all tabs
     64                        "translate": True,  # turn automatic label translation on/off (default=True)
     65                        "widgets": [...],   # list of widgets for this section
     66                        },
     67                        {...}, # next section
     68                        ...
     69                       ]
     70}}}
     71
     72Sections are rendered in the order in which they are configured.
     73
     74=== Widget Configuration ===
     75
     76Each widget configuration is a dict in the "widgets" list of a section:
     77{{{#!python
     78settings.ui.summary = [{"name": "table",
     79                        "label": "Table",
     80                        "common": False,
     81                        "translate": True,
     82                        "widgets": [
     83                           {"method": "datatable",  # widget method, either a name that resolves into
     84                                                    # a S3Method, or a callable to render the widget
     85
     86                            "filterable": True,     # Whether the widget can be filtered by the summary
     87                                                    # filter form
     88
     89                            "ajax_init": False,     # Whether the widget requires an Ajax-request to initialize
     90                                                    # True for "report" and "map" widgets
     91                            },
     92                           {...},                   # Next widget
     93                         ],
     94                        },
     95                       ]
     96}}}
     97
     98If a method name is passed for "method", it is important that the corresponding method handler implements the widget() interface.
     99
     100Instead of a name, you can also specify a callable that returns either HTML content, or a dict of variables for the view template.
    35101== Code ==
    36102