web/data/cubicweb.edition.js
changeset 2867 e8581a4f1bae
parent 2859 822258915ff0
child 3100 b0a583156d6d
child 3124 c929360212ca
equal deleted inserted replaced
2855:1d9be3dffa94 2867:e8581a4f1bae
   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 	var form = jQuery(dom);
   251         preprocessAjaxLoad(null, dom);
   252 	form.css('display', 'none');
   252         var form = jQuery(dom);
   253 	form.insertBefore(linknode.parentNode).slideDown('fast');
   253         form.css('display', 'none');
   254 	updateInlinedEntitiesCounters(rtype);
   254         form.insertBefore(insertBefore).slideDown('fast');
   255 	reorderTabindex();
   255         updateInlinedEntitiesCounters(rtype);
   256 	form.trigger('inlinedform-added');
   256         reorderTabindex();
       
   257         form.trigger('inlinedform-added');
   257         postAjaxLoad(dom);
   258         postAjaxLoad(dom);
   258     });
   259     });
   259     d.addErrback(function (xxx) {
   260     d.addErrback(function (xxx) {
   260 	log('xxx =', xxx);
   261         log('xxx =', xxx);
   261     });
   262     });
   262 }
   263 }
   263 
   264 
   264 /*
   265 /*
   265  * 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