customizable breakcrumbs in smartgrid, thanks Paolo
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-06-04 16:03:19) dev
|
Version 2.00.0 (2012-06-04 18:45:13) dev
|
||||||
|
|||||||
@@ -290,5 +290,14 @@ div.error {
|
|||||||
|
|
||||||
#w2p_query_panel {}
|
#w2p_query_panel {}
|
||||||
|
|
||||||
|
.web2py_breadcrumbs ul {
|
||||||
|
list-style: none;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.web2py_breadcrumbs ul li {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
.ie9 #query_panel {padding-bottom:2px;}
|
.ie9 #query_panel {padding-bottom:2px;}
|
||||||
|
|
||||||
|
|||||||
+9
-8
@@ -1949,6 +1949,7 @@ class SQLFORM(FORM):
|
|||||||
def smartgrid(table, constraints=None, linked_tables=None,
|
def smartgrid(table, constraints=None, linked_tables=None,
|
||||||
links=None, links_in_grid=True,
|
links=None, links_in_grid=True,
|
||||||
args=None, user_signature=True,
|
args=None, user_signature=True,
|
||||||
|
divider='>', breadcrumbs_class='',
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""
|
"""
|
||||||
@auth.requires_login()
|
@auth.requires_login()
|
||||||
@@ -1979,7 +1980,7 @@ class SQLFORM(FORM):
|
|||||||
linked_tables is a optional list of tablenames of tables
|
linked_tables is a optional list of tablenames of tables
|
||||||
to be linked
|
to be linked
|
||||||
"""
|
"""
|
||||||
from gluon import current, A, URL, DIV, H3, redirect
|
from gluon import current, A, URL, DIV, H3, UL, LI, SPAN, redirect
|
||||||
request, T = current.request, current.T
|
request, T = current.request, current.T
|
||||||
if args is None: args = []
|
if args is None: args = []
|
||||||
db = table._db
|
db = table._db
|
||||||
@@ -2020,14 +2021,14 @@ class SQLFORM(FORM):
|
|||||||
else: name = format % record
|
else: name = format % record
|
||||||
except TypeError:
|
except TypeError:
|
||||||
name = id
|
name = id
|
||||||
breadcrumbs += [A(T(db[referee]._plural),
|
breadcrumbs += [LI(A(T(db[referee]._plural),
|
||||||
_class=trap_class(),
|
_class=trap_class(),
|
||||||
_href=URL(args=request.args[:nargs])),
|
_href=URL(args=request.args[:nargs])),
|
||||||
' > ',
|
SPAN(divider,_class='divider')),
|
||||||
A(name,_class=trap_class(),
|
LI(A(name,_class=trap_class(),
|
||||||
_href=URL(args=request.args[:nargs]+[
|
_href=URL(args=request.args[:nargs]+[
|
||||||
'view',referee,id],user_signature=True)),
|
'view',referee,id],user_signature=True)),
|
||||||
' > ']
|
SPAN(divider,_class='divider'))]
|
||||||
nargs+=2
|
nargs+=2
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
@@ -2074,9 +2075,9 @@ class SQLFORM(FORM):
|
|||||||
user_signature=user_signature,**kwargs)
|
user_signature=user_signature,**kwargs)
|
||||||
if isinstance(grid,DIV):
|
if isinstance(grid,DIV):
|
||||||
header = table._plural + (field and ' for '+field.name or '')
|
header = table._plural + (field and ' for '+field.name or '')
|
||||||
breadcrumbs.append(A(T(header),_class=trap_class(),
|
breadcrumbs.append(LI(A(T(header),_class=trap_class(),
|
||||||
_href=URL(args=request.args[:nargs])))
|
_href=URL(args=request.args[:nargs])), _class='active'))
|
||||||
grid.insert(0,DIV(H3(*breadcrumbs),_class='web2py_breadcrumbs'))
|
grid.insert(0,DIV(UL(*breadcrumbs, _class=breadcrumbs_class), _class='web2py_breadcrumbs'))
|
||||||
return grid
|
return grid
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user