Noosfero/noosfero

View on GitHub
plugins/container_block/public/container_block.js

Summary

Maintainability
A
0 mins
Test Coverage
function enableMoveContainerChildren(container, box) {
  var div = jQuery('#box-'+box+' >  .block');
  if(!div.is('.ui-resizable')) {
    div.removeClass('ui-draggable');
    div.resizable({
      handles: 'e, w',
      containment: '#block-'+container+' .block-inner-2',
      resize: function( event, ui ) {
        ui.element.height('auto');
      }
    });
  }
}

function disableMoveContainerChildren(container, box) {
  var div = jQuery('#box-'+box+' > .block');
  if(div.is('.ui-resizable')) {
    div.addClass('ui-draggable');
    div.resizable('destroy');
  }
}

function containerChildrenWidth(container, box) {
  widths = "";
  jQuery('#box-'+box+' > .block').each(function(i) {
    childId = jQuery(this).attr('id').match(/block-(\d+)/)[1];
    widths+=childId+","+jQuery(this).width()+"|";
  });
  return "widths="+widths;
}