web/data/cubicweb.edition.js
changeset 4378 785c56bdacc6
parent 4279 e6b9fd79a247
child 4382 6fb02edd05da
equal deleted inserted replaced
4377:0e9cf6593382 4378:785c56bdacc6
   228     });
   228     });
   229 
   229 
   230 }
   230 }
   231 
   231 
   232 
   232 
   233 function updateInlinedEntitiesCounters(rtype) {
   233 function updateInlinedEntitiesCounters(rtype, role) {
   234     jQuery('#inline' + rtype + 'slot span.icounter').each(function (i) {
   234     jQuery('div.inline-' + rtype + '-' + role + '-slot span.icounter').each(function (i) {
   235 	this.innerHTML = i+1;
   235 	this.innerHTML = i+1;
   236     });
   236     });
   237 }
   237 }
   238 
   238 
   239 
   239 
   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(insertBefore).slideDown('fast');
   254         form.insertBefore(insertBefore).slideDown('fast');
   255         updateInlinedEntitiesCounters(rtype);
   255         updateInlinedEntitiesCounters(rtype, role);
   256         reorderTabindex();
   256         reorderTabindex();
   257         jQuery(CubicWeb).trigger('inlinedform-added', form);
   257         jQuery(CubicWeb).trigger('inlinedform-added', form);
   258         // if the inlined form contains a file input, we must force
   258         // if the inlined form contains a file input, we must force
   259         // the form enctype to multipart/form-data
   259         // the form enctype to multipart/form-data
   260         if (form.find('input:file').length) {
   260         if (form.find('input:file').length) {
   271 }
   271 }
   272 
   272 
   273 /*
   273 /*
   274  * removes the part of the form used to edit an inlined entity
   274  * removes the part of the form used to edit an inlined entity
   275  */
   275  */
   276 function removeInlineForm(peid, rtype, eid, showaddnewlink) {
   276 function removeInlineForm(peid, rtype, role, eid, showaddnewlink) {
   277     jqNode(['div', peid, rtype, eid].join('-')).slideUp('fast', function() {
   277     jqNode(['div', peid, rtype, eid].join('-')).slideUp('fast', function() {
   278 	$(this).remove();
   278 	$(this).remove();
   279 	updateInlinedEntitiesCounters(rtype);
   279 	updateInlinedEntitiesCounters(rtype, role);
   280     });
   280     });
   281     if (showaddnewlink) {
   281     if (showaddnewlink) {
   282 	toggleVisibility(showaddnewlink);
   282 	toggleVisibility(showaddnewlink);
   283     }
   283     }
   284 }
   284 }