Skip to content
Snippets Groups Projects
Commit 953e5205 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Rename the converter to_panelWithUrlSelector and improve it.

parent cdf406e6
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ def report_2():
"""Return the url arguments
"""
selector = Selector(db, extfield='my_format')
selector = Selector(virtdb.foo1, extfield='my_format')
# user request a file with a specific format (latex,...)
iframe = selector.download()
......
......@@ -23,7 +23,8 @@ reportNode = dbui.Node(T('Reports'))
node = dbui.Panel(html="salut ma poule")
reportNode.add_child(T('report_1'), node)
node = dbui.to_panel_with_url_selector(virtdb.foo1, URL('reports', 'report_2'))
node = dbui.to_panelWithUrlSelector(virtdb.foo1,
baseUrl=URL('reports', 'report_2'))
reportNode.add_child(T('report_2'), node)
versionNode = dbui.Panel(autoLoad='/'+request.application+'/default/versions')
......
......@@ -10,7 +10,7 @@ from converter import (to_field,
to_gridFilter,
to_gridPanel,
to_jsonstore,
to_panel_with_url_selector,
to_panelWithUrlSelector,
to_tree,
to_viewport)
from dbsvc import DbSvc
......
......@@ -586,32 +586,37 @@ def to_jsonstore(table, **kwargs):
return cfg
def to_panel_with_url_selector(table, url, is_mathjax=False):
"""Build the configuration for a PanelWithUrlSelector
def to_panelWithUrlSelector(table, **kwargs):
"""Build the configuration for a simple PanelWithUrlSelector
where the selector is a form derived from the database table.
The selected values are send to a controller defined by the URL.
The selected values are send to a controller defined by the baseUrl.
Values are processed and results will be published in the panel.
It is mandatory to specified the baseUrl.
The others keyword arguments are the configuration parameters
of the PanelWithUrlSelector. By default is_mathjax is False,
and panelCfg, selectorCfg, selectorCollapsible are defined.
table
gluon.dal.Table
url
well form URL
"""
if 'baseUrl' not in kwargs:
raise BaseException('The keyword argument basseUrl is missing.')
# build the selector from the table
fields = to_fields(table)
selector = FieldSet(items=fields,
plugins=['pFormToolTip'],
title=current.T('Select'))
# build the configuration for the PanelWithUrlSelector
cfg = PanelWithUrlSelector(baseUrl=url,
isMathJax=is_mathjax,
panelCfg=Panel(),
selectorCfg=selector,
selectorCollapsible=False)
default = dict(isMathJax=False,
panelCfg=Panel(),
selectorCfg=selector,
selectorCollapsible=False)
default.update(kwargs)
cfg = PanelWithUrlSelector(**default)
return cfg
......
<h3>Report_2</h3>
{{for k in test:}}
<br>{{=k}}: {{=test[k]}}{{pass}}
<hr>
{{=BEAUTIFY(test)}}
<hr>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment