fixed issue 1247 Missing URL for Delete button, thanks Boris and Niphlod
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.4.1-alpha.2+timestamp.2012.12.30.15.15.53
|
||||
Version 2.4.1-alpha.2+timestamp.2012.12.31.14.38.01
|
||||
|
||||
+2
-2
@@ -1478,9 +1478,9 @@ class A(DIV):
|
||||
(self['component'], self['target'] or '', d)
|
||||
self['_href'] = self['_href'] or '#null'
|
||||
elif self['callback']:
|
||||
returnfalse = "var e = arguments[0] || window.event; e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation();"
|
||||
returnfalse = "var e = arguments[0] || window.event; e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); e.preventDefault();"
|
||||
if d:
|
||||
self['_onclick'] = "if(confirm(w2p_ajax_confirm_message||'Are you sure you want o 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)
|
||||
else:
|
||||
self['_onclick'] = "ajax('%s',[],'%s');%sreturn false" % \
|
||||
|
||||
+17
-23
@@ -1807,28 +1807,21 @@ class SQLFORM(FORM):
|
||||
buttonurl=url(args=[]), callback=None,
|
||||
delete=None, trap=True):
|
||||
if showbuttontext:
|
||||
if callback:
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
SPAN(T(buttontext), _title=buttontext,
|
||||
_class=ui.get('buttontext')),
|
||||
callback=callback, delete=delete,
|
||||
_class=trap_class(ui.get('button'), trap))
|
||||
else:
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
SPAN(T(buttontext), _title=buttontext,
|
||||
_class=ui.get('buttontext')),
|
||||
_href=buttonurl,
|
||||
_class=trap_class(ui.get('button'), trap))
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
SPAN(T(buttontext), _title=buttontext,
|
||||
_class=ui.get('buttontext')),
|
||||
_href=buttonurl,
|
||||
callback=callback,
|
||||
delete=delete,
|
||||
_class=trap_class(ui.get('button'), trap))
|
||||
else:
|
||||
if callback:
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
callback=callback, delete=delete,
|
||||
_title=buttontext,
|
||||
_class=trap_class(ui.get('buttontext'), trap))
|
||||
else:
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
_href=buttonurl, _title=buttontext,
|
||||
_class=trap_class(ui.get('buttontext'), trap))
|
||||
return A(SPAN(_class=ui.get(buttonclass)),
|
||||
_href=buttonurl,
|
||||
callback=callback,
|
||||
delete=delete,
|
||||
_title=buttontext,
|
||||
_class=trap_class(ui.get('buttontext'), trap))
|
||||
|
||||
dbset = db(query)
|
||||
tablenames = db._adapter.tables(dbset.query)
|
||||
if left is not None:
|
||||
@@ -1948,8 +1941,8 @@ class SQLFORM(FORM):
|
||||
table = db[request.args[-2]]
|
||||
if ondelete:
|
||||
ondelete(table, request.args[-1])
|
||||
ret = db(table[table._id.name] == request.args[-1]).delete()
|
||||
return ret
|
||||
db(table[table._id.name] == request.args[-1]).delete()
|
||||
redirect(referrer)
|
||||
|
||||
exportManager = dict(
|
||||
csv_with_hidden_cols=(ExporterCSV, 'CSV (hidden cols)'),
|
||||
@@ -2293,6 +2286,7 @@ class SQLFORM(FORM):
|
||||
if deletable and (not callable(deletable) or deletable(row)):
|
||||
row_buttons.append(gridbutton(
|
||||
'buttondelete', 'Delete',
|
||||
url(args=['delete', tablename, id]),
|
||||
callback=url(args=['delete', tablename, id]),
|
||||
delete='tr'))
|
||||
if buttons_placement in ['right', 'both']:
|
||||
|
||||
Reference in New Issue
Block a user