noconfirm in grid, thanks Niphlod
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.4.2-stable+timestamp.2013.03.09.09.33.46
|
Version 2.4.2-stable+timestamp.2013.03.09.09.35.34
|
||||||
|
|||||||
+1
-1
@@ -1479,7 +1479,7 @@ class A(DIV):
|
|||||||
self['_href'] = self['_href'] or '#null'
|
self['_href'] = self['_href'] or '#null'
|
||||||
elif self['callback']:
|
elif self['callback']:
|
||||||
returnfalse = "var e = arguments[0] || window.event; e.cancelBubble=true; if (e.stopPropagation) {e.stopPropagation(); e.stopImmediatePropagation(); e.preventDefault();}"
|
returnfalse = "var e = arguments[0] || window.event; e.cancelBubble=true; if (e.stopPropagation) {e.stopPropagation(); e.stopImmediatePropagation(); e.preventDefault();}"
|
||||||
if d:
|
if d and not self['noconfirm']:
|
||||||
self['_onclick'] = "if(confirm(w2p_ajax_confirm_message||'Are you sure you want to delete this object?')){ajax('%s',[],'%s');%s};%s" % \
|
self['_onclick'] = "if(confirm(w2p_ajax_confirm_message||'Are you sure you want to delete this object?')){ajax('%s',[],'%s');%s};%s" % \
|
||||||
(self['callback'], self['target'] or '', d, returnfalse)
|
(self['callback'], self['target'] or '', d, returnfalse)
|
||||||
else:
|
else:
|
||||||
|
|||||||
+6
-3
@@ -1760,7 +1760,8 @@ class SQLFORM(FORM):
|
|||||||
editargs={},
|
editargs={},
|
||||||
viewargs={},
|
viewargs={},
|
||||||
buttons_placement = 'right',
|
buttons_placement = 'right',
|
||||||
links_placement = 'right'
|
links_placement = 'right',
|
||||||
|
noconfirm=False
|
||||||
):
|
):
|
||||||
|
|
||||||
# jQuery UI ThemeRoller classes (empty if ui is disabled)
|
# jQuery UI ThemeRoller classes (empty if ui is disabled)
|
||||||
@@ -1849,7 +1850,7 @@ class SQLFORM(FORM):
|
|||||||
|
|
||||||
def gridbutton(buttonclass='buttonadd', buttontext=T('Add'),
|
def gridbutton(buttonclass='buttonadd', buttontext=T('Add'),
|
||||||
buttonurl=url(args=[]), callback=None,
|
buttonurl=url(args=[]), callback=None,
|
||||||
delete=None, trap=True):
|
delete=None, trap=True, noconfirm=None):
|
||||||
if showbuttontext:
|
if showbuttontext:
|
||||||
return A(SPAN(_class=ui.get(buttonclass)),
|
return A(SPAN(_class=ui.get(buttonclass)),
|
||||||
SPAN(T(buttontext), _title=buttontext,
|
SPAN(T(buttontext), _title=buttontext,
|
||||||
@@ -1857,12 +1858,14 @@ class SQLFORM(FORM):
|
|||||||
_href=buttonurl,
|
_href=buttonurl,
|
||||||
callback=callback,
|
callback=callback,
|
||||||
delete=delete,
|
delete=delete,
|
||||||
|
noconfirm=noconfirm,
|
||||||
_class=trap_class(ui.get('button'), trap))
|
_class=trap_class(ui.get('button'), trap))
|
||||||
else:
|
else:
|
||||||
return A(SPAN(_class=ui.get(buttonclass)),
|
return A(SPAN(_class=ui.get(buttonclass)),
|
||||||
_href=buttonurl,
|
_href=buttonurl,
|
||||||
callback=callback,
|
callback=callback,
|
||||||
delete=delete,
|
delete=delete,
|
||||||
|
noconfirm=noconfirm,
|
||||||
_title=buttontext,
|
_title=buttontext,
|
||||||
_class=trap_class(ui.get('buttontext'), trap))
|
_class=trap_class(ui.get('buttontext'), trap))
|
||||||
|
|
||||||
@@ -2341,6 +2344,7 @@ class SQLFORM(FORM):
|
|||||||
'buttondelete', 'Delete',
|
'buttondelete', 'Delete',
|
||||||
url(args=['delete', tablename, id]),
|
url(args=['delete', tablename, id]),
|
||||||
callback=url(args=['delete', tablename, id]),
|
callback=url(args=['delete', tablename, id]),
|
||||||
|
noconfirm=noconfirm,
|
||||||
delete='tr'))
|
delete='tr'))
|
||||||
if buttons_placement in ['right', 'both']:
|
if buttons_placement in ['right', 'both']:
|
||||||
trcols.append(row_buttons)
|
trcols.append(row_buttons)
|
||||||
@@ -2994,4 +2998,3 @@ class ExporterJSON(ExportClass):
|
|||||||
return self.rows.as_json()
|
return self.rows.as_json()
|
||||||
else:
|
else:
|
||||||
return 'null'
|
return 'null'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user