web/data/cubicweb.edition.js
branchstable
changeset 2859 822258915ff0
parent 2852 858b33162e9d
child 3100 b0a583156d6d
child 3124 c929360212ca
equal deleted inserted replaced
2858:322272c5d67f 2859:822258915ff0
   241  * makes an AJAX request to get an inline-creation view's content
   241  * makes an AJAX request to get an inline-creation view's content
   242  * @param peid : the parent entity eid
   242  * @param peid : the parent entity eid
   243  * @param ttype : the target (inlined) entity type
   243  * @param ttype : the target (inlined) entity type
   244  * @param rtype : the relation type between both entities
   244  * @param rtype : the relation type between both entities
   245  */
   245  */
   246 function addInlineCreationForm(peid, ttype, rtype, role) {
   246 function addInlineCreationForm(peid, ttype, rtype, role, insertBefore) {
       
   247     insertBefore = insertBefore || getNode('add' + rtype + ':' + peid + 'link').parentNode;
   247     var d = asyncRemoteExec('inline_creation_form', peid, ttype, rtype, role);
   248     var d = asyncRemoteExec('inline_creation_form', peid, ttype, rtype, role);
   248     d.addCallback(function (response) {
   249     d.addCallback(function (response) {
   249 	var linknode = getNode('add' + rtype + ':' + peid + 'link');
       
   250         var dom = getDomFromResponse(response);
   250         var dom = getDomFromResponse(response);
   251 	preprocessAjaxLoad(null, dom);
   251         preprocessAjaxLoad(null, dom);
   252 	var form = jQuery(dom);
   252         var form = jQuery(dom);
   253 	form.css('display', 'none');
   253         form.css('display', 'none');
   254 	form.insertBefore(linknode.parentNode).slideDown('fast');
   254         form.insertBefore(insertBefore).slideDown('fast');
   255 	updateInlinedEntitiesCounters(rtype);
   255         updateInlinedEntitiesCounters(rtype);
   256 	reorderTabindex();
   256         reorderTabindex();
   257 	form.trigger('inlinedform-added');
   257         form.trigger('inlinedform-added');
   258         postAjaxLoad(dom);
   258         postAjaxLoad(dom);
   259     });
   259     });
   260     d.addErrback(function (xxx) {
   260     d.addErrback(function (xxx) {
   261 	log('xxx =', xxx);
   261         log('xxx =', xxx);
   262     });
   262     });
   263 }
   263 }
   264 
   264 
   265 /*
   265 /*
   266  * removes the part of the form used to edit an inlined entity
   266  * removes the part of the form used to edit an inlined entity