cirandas.net

ref: master

plugins/container_block/public/container_block.js


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function enableMoveContainerChildren(container, box) {
  var div = jQuery('#box-'+box+' > .block-outer > .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-outer > .block');
  if(div.is('.ui-resizable')) {
    div.addClass('ui-draggable');
    div.resizable('destroy');
  }
}

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