noconfirm in grid, thanks Niphlod
This commit is contained in:
1 parent
8e5be952bf
commit
810aa8f4f3
3 files changed
+8
-5
No files matched your search
@@ -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'
|
||||
elif self['callback']:
|
||||
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['callback'], self['target'] or '', d, returnfalse)
|
||||
else:
|
||||
|
||||
+6
-3
@@ -1760,7 +1760,8 @@ class SQLFORM(FORM):
|
||||
editargs={},
|
||||
viewargs={},
|
||||
buttons_placement = 'right',
|
||||
links_placement = 'right'
|
||||
links_placement = 'right',
|
||||
noconfirm=False
|
||||
):
|
||||
|
||||
# jQuery UI ThemeRoller classes (empty if ui is disabled)
|
||||
@@ -1849,7 +1850,7 @@ class SQLFORM(FORM):
|
||||
|
||||
def gridbutton(buttonclass='buttonadd', buttontext=T('Add'),
|
||||
buttonurl=url(args=[]), callback=None,
|
||||
delete=None, trap=True):
|
||||
delete=None, trap=True, noconfirm=None):
|
||||
if showbuttontext:
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
SPAN(T(buttontext), _title=buttontext,
|
||||
@@ -1857,12 +1858,14 @@ class SQLFORM(FORM):
|
||||
_href=buttonurl,
|
||||
callback=callback,
|
||||
delete=delete,
|
||||
noconfirm=noconfirm,
|
||||
_class=trap_class(ui.get('button'), trap))
|
||||
else:
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
_href=buttonurl,
|
||||
callback=callback,
|
||||
delete=delete,
|
||||
noconfirm=noconfirm,
|
||||
_title=buttontext,
|
||||
_class=trap_class(ui.get('buttontext'), trap))
|
||||
|
||||
@@ -2341,6 +2344,7 @@ class SQLFORM(FORM):
|
||||
'buttondelete', 'Delete',
|
||||
url(args=['delete', tablename, id]),
|
||||
callback=url(args=['delete', tablename, id]),
|
||||
noconfirm=noconfirm,
|
||||
delete='tr'))
|
||||
if buttons_placement in ['right', 'both']:
|
||||
trcols.append(row_buttons)
|
||||
@@ -2994,4 +2998,3 @@ class ExporterJSON(ExportClass):
|
||||
return self.rows.as_json()
|
||||
else:
|
||||
return 'null'
|
||||
|
||||
Reference in new issue
Block a user