# HG changeset patch # User Adrien Di Mascio # Date 1250269305 -7200 # Node ID 822258915ff0400916fd9e379ca76b213dc7eeef # Parent 322272c5d67fcab14aaa9f7ea8a5335179515815 [javascript] allow customization of inlineCreationForm insertion point diff -r 322272c5d67f -r 822258915ff0 web/data/cubicweb.edition.js --- a/web/data/cubicweb.edition.js Fri Aug 14 18:55:31 2009 +0200 +++ b/web/data/cubicweb.edition.js Fri Aug 14 19:01:45 2009 +0200 @@ -243,22 +243,22 @@ * @param ttype : the target (inlined) entity type * @param rtype : the relation type between both entities */ -function addInlineCreationForm(peid, ttype, rtype, role) { +function addInlineCreationForm(peid, ttype, rtype, role, insertBefore) { + insertBefore = insertBefore || getNode('add' + rtype + ':' + peid + 'link').parentNode; var d = asyncRemoteExec('inline_creation_form', peid, ttype, rtype, role); d.addCallback(function (response) { - var linknode = getNode('add' + rtype + ':' + peid + 'link'); var dom = getDomFromResponse(response); - preprocessAjaxLoad(null, dom); - var form = jQuery(dom); - form.css('display', 'none'); - form.insertBefore(linknode.parentNode).slideDown('fast'); - updateInlinedEntitiesCounters(rtype); - reorderTabindex(); - form.trigger('inlinedform-added'); + preprocessAjaxLoad(null, dom); + var form = jQuery(dom); + form.css('display', 'none'); + form.insertBefore(insertBefore).slideDown('fast'); + updateInlinedEntitiesCounters(rtype); + reorderTabindex(); + form.trigger('inlinedform-added'); postAjaxLoad(dom); }); d.addErrback(function (xxx) { - log('xxx =', xxx); + log('xxx =', xxx); }); }