Commit 6f746463158b407becfe8b45d9ba5e227a85c7d7

Authored by Victor Costa
1 parent e2ce513c

Fix javascript for container block edition and enable move left/right

plugins/container_block/public/style.css
... ... @@ -2,8 +2,12 @@
2 2 float: left;
3 3 }
4 4  
5   -#content .boxes .container-block .block .icon-down, #content .boxes .container-block .block .icon-down-disabled, #content .boxes .container-block .block .icon-up, #content .boxes .container-block .block .icon-up-disabled {
6   - display: none;
  5 +#content .boxes .container-block .block .icon-down, #content .boxes .container-block .block .icon-down-disabled {
  6 + background-image: url(/designs/icons/default/Tango/16x16/actions/go-next.png);
  7 +}
  8 +
  9 +#content .boxes .container-block .block .icon-up, #content .boxes .container-block .block .icon-up-disabled {
  10 + background-image: url(/designs/icons/default/Tango/16x16/actions/go-previous.png);
7 11 }
8 12  
9 13 #content .boxes .container-block .block {
... ...
plugins/container_block/views/blocks/container.rhtml
... ... @@ -2,7 +2,7 @@
2 2 <% box_decorator = edit_mode ? self : BoxesHelper::DontMoveBlocks %>
3 3  
4 4 <% box_decorator.select_blocks(block.blocks, { :article => @page, :request_path => request.path, :locale => locale }).each do |child| %>
5   - <div class="container_block_child">
  5 + <div class="container_block_child" id="container_block_child_<%= block.id %>">
6 6 <%= display_block(child, '') %>
7 7 </div>
8 8 <style>#block-<%=child.id%> { width: <%= block.child_width(child.id) %>px; }</style>
... ... @@ -15,20 +15,23 @@
15 15 <%= link_to_remote '', :url => { :controller => @controller.boxes_holder.kind_of?(Environment) ? 'container_block_plugin_admin' : 'container_block_plugin_myprofile', :action => 'saveWidths', :id => block.id },
16 16 :with => "containerChildrenWidth(#{block.id})",
17 17 :html => {:class => "button icon-save container_block_save", :id => "container_block_save_#{block.id}" },
18   - :loading => "",
19   - :loaded => "" %>
  18 + :loading => "open_loading(DEFAULT_LOADING_MESSAGE);",
  19 + :loaded => "close_loading();" %>
20 20 </div>
21 21  
22 22 <script>
23   - function saveWidth(container) {
24   - }
25   -
26 23 function toggleMoveContainerChildren(container) {
27   - var containerDiv = jQuery('#block-'+container+' .container_block_child .block');
  24 + var containerDiv = jQuery('#block-'+container+' #container_block_child_'+container+' > .block');
28 25 if(containerDiv.is('.ui-resizable')) {
29 26 containerDiv.resizable('destroy');
30 27 } else {
31   - containerDiv.resizable({handles: 'e, w'});
  28 + containerDiv.resizable({
  29 + handles: 'e, w',
  30 + containment: '#block-'+container+' .block-inner-2',
  31 + resize: function( event, ui ) {
  32 + ui.element.height('auto');
  33 + }
  34 + });
32 35 }
33 36 }
34 37  
... ...