# HG changeset patch # User Julien Cristau # Date 1406110070 -7200 # Node ID 30b56a56c1f410e9d3eff02de263f63f831abf10 # Parent a74e9e43806a2b3ae65a5c0d2e965ed24e37c057 [web/js] replace callAddOrDeleteThenReload with more generic callAjaxFuncThenReload That's going to be a more useful replacement for callUserCallbackThenReload. Closes #4178566. diff -r a74e9e43806a -r 30b56a56c1f4 web/component.py --- a/web/component.py Tue Jul 22 17:45:38 2014 +0200 +++ b/web/component.py Wed Jul 23 12:07:50 2014 +0200 @@ -513,10 +513,10 @@ """builds HTML link to edit relation between `entity` and `etarget`""" args = {role(self) : entity.eid, target(self): etarget.eid} # for each target, provide a link to edit the relation - jscall = unicode(js.cw.utils.callAddOrDeleteThenReload(fname, - self.rtype, - args['subject'], - args['object'])) + jscall = unicode(js.cw.utils.callAjaxFuncThenReload(fname, + self.rtype, + args['subject'], + args['object'])) return u'[%s] %s' % ( xml_escape(jscall), label, etarget.view('incontext')) diff -r a74e9e43806a -r 30b56a56c1f4 web/data/cubicweb.js --- a/web/data/cubicweb.js Tue Jul 22 17:45:38 2014 +0200 +++ b/web/data/cubicweb.js Wed Jul 23 12:07:50 2014 +0200 @@ -390,14 +390,14 @@ ); }, - callAddOrDeleteThenReload: function (add_or_delete, rtype, subjeid, objeid) { - var d = asyncRemoteExec(add_or_delete, rtype, subjeid, objeid); - d.addCallback(function() { + callAjaxFuncThenReload: function callAjaxFuncThenReload (/*...*/) { + var d = asyncRemoteExec.apply(null, arguments); + d.addCallback(function(msg) { window.location.reload(); + if (msg) + updateMessage(msg); }); } - - }); /** DOM factories ************************************************************/