Commit e2ce513c45d8d7ff969a2aba5e2dcf174b54bfe6

Authored by Victor Costa
1 parent 4074bc1b

Better edit mode to container block

plugins/container_block/public/images/handle_e.png 0 → 100644

458 Bytes

plugins/container_block/public/images/handle_w.png 0 → 100644

505 Bytes

plugins/container_block/public/style.css
... ... @@ -12,21 +12,20 @@
12 12  
13 13 #content .boxes .container-block .block .ui-resizable-handle {
14 14 width: 10px;
15   - height: 25px;
16   - background-color: #ffffff;
17   - border: 1px solid #000000;
  15 + height: 28px;
18 16 z-index: 0;
19 17 }
20 18  
21 19 #content .boxes .container-block .block .ui-resizable-e {
22   - right:-5px;
23   - top:0%;
24   - background-color: #AAA;
  20 + right: -2px;
  21 + background-image: url(/plugins/container_block/images/handle_e.png);
25 22 }
26 23  
27 24 #content .boxes .container-block .block .ui-resizable-w {
28   - left:-5px;
29   - top:50%;
30   - background-color: #CCC;
  25 + left: -2px;
  26 + background-image: url(/plugins/container_block/images/handle_w.png);
31 27 }
32 28  
  29 +.container-block .button-bar .icon-resize {
  30 + background-image: url(/designs/icons/default/Tango/16x16/actions/view-fullscreen.png);
  31 +}
... ...
plugins/container_block/views/blocks/container.rhtml
... ... @@ -11,11 +11,26 @@
11 11  
12 12 <% if edit_mode %>
13 13 <div class="button-bar">
14   - <%= link_to_remote '', :url => { :controller => @controller.boxes_holder.kind_of?(Environment) ? 'container_block_plugin_admin' : 'container_block_plugin_myprofile', :action => 'saveWidths', :id => block.id }, :with => "containerChildrenWidth(#{block.id})", :html => {:class => "button icon-save container_block_save" } %>
  14 + <a href="#" onclick="toggleMoveContainerChildren(<%= block.id %>); return false;" class="button icon-resize"></a>
  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 + :with => "containerChildrenWidth(#{block.id})",
  17 + :html => {:class => "button icon-save container_block_save", :id => "container_block_save_#{block.id}" },
  18 + :loading => "",
  19 + :loaded => "" %>
15 20 </div>
16 21  
17 22 <script>
18   - jQuery('.container-block .container_block_child .block').resizable({handles: 'e, w'});
  23 + function saveWidth(container) {
  24 + }
  25 +
  26 + function toggleMoveContainerChildren(container) {
  27 + var containerDiv = jQuery('#block-'+container+' .container_block_child .block');
  28 + if(containerDiv.is('.ui-resizable')) {
  29 + containerDiv.resizable('destroy');
  30 + } else {
  31 + containerDiv.resizable({handles: 'e, w'});
  32 + }
  33 + }
19 34  
20 35 function containerChildrenWidth(container) {
21 36 widths = "";
... ...