Skip to content

Instantly share code, notes, and snippets.

@kawahara
Created August 3, 2010 07:24
Show Gist options
  • Save kawahara/505989 to your computer and use it in GitHub Desktop.
Save kawahara/505989 to your computer and use it in GitHub Desktop.
diff --git a/apps/pc_frontend/modules/member/templates/homeSuccess.php b/apps/pc_frontend/modules/member/templates/homeSuccess.php
index 43f5e3d..977ecf1 100644
--- a/apps/pc_frontend/modules/member/templates/homeSuccess.php
+++ b/apps/pc_frontend/modules/member/templates/homeSuccess.php
@@ -1,5 +1,21 @@
<?php use_helper('Javascript') ?>
+<?php $sortable_params = array(
+ 'tag' => 'div',
+ 'handle' => 'partsHeading',
+ 'onChange' => 'function(obj){storeSort(obj)}',
+ 'dropOnEmpty' => true,
+ 'constraint' => false,
+ 'containment' => array()
+);
+
+if (isset($topGadgets)) $sortable_params['containment'][] = 'Top';
+if (isset($sideMenuGadgets)) $sortable_params['containment'][] = 'Left';
+if (isset($contentsGadgets)) $sortable_params['containment'][] = 'Center';
+if (isset($bottomGadgets)) $sortable_params['containment'][] = 'Bottom';
+
+?>
+
<?php if (isset($topGadgets)): ?>
<?php slot('op_top') ?>
<?php foreach ($topGadgets as $gadget): ?>
@@ -8,7 +24,7 @@
<?php endif; ?>
<?php endforeach; ?>
<?php end_slot() ?>
-<?php echo sortable_element('Top', array('tag' => 'div', 'handle' => 'partsHeading', 'onChange' => 'function(obj){storeSort(obj)}')) ?>
+<?php echo sortable_element('Top', $sortable_params) ?>
<?php endif; ?>
<?php if (isset($sideMenuGadgets)): ?>
@@ -19,7 +35,7 @@
<?php endif; ?>
<?php endforeach; ?>
<?php end_slot() ?>
-<?php echo sortable_element('Left', array('tag' => 'div', 'handle' => 'partsHeading', 'onChange' => 'function(obj){storeSort(obj)}')) ?>
+<?php echo sortable_element('Left', $sortable_params) ?>
<?php endif; ?>
<?php if (isset($contentsGadgets)): ?>
@@ -28,7 +44,7 @@
<?php include_component($gadget->getComponentModule(), $gadget->getComponentAction(), array('gadget' => $gadget)); ?>
<?php endif; ?>
<?php endforeach; ?>
-<?php echo sortable_element('Center', array('tag' => 'div', 'handle' => 'partsHeading', 'onChange' => 'function(obj){storeSort(obj)}')) ?>
+<?php echo sortable_element('Center', $sortable_params) ?>
<?php endif; ?>
<?php if (isset($bottomGadgets)): ?>
@@ -39,7 +55,7 @@
<?php endif; ?>
<?php endforeach; ?>
<?php end_slot() ?>
-<?php echo sortable_element('Bottom', array('tag' => 'div', 'handle' => 'partsHeading')) ?>
+<?php echo sortable_element('Bottom', $sortable_params) ?>
<?php endif; ?>
<?php echo javascript_tag('
@kawahara
Copy link
Author

kawahara commented Aug 3, 2010

俺メモ

現状いろいろ難有り

例えば

  • 移動するとき、overflow:hidden のブロック要素に隠されて見にくい
  • 空の領域に移動するときに、なんか移動できないケースあり。駄目じゃん。
  • とにかくUIがダメ。移動するときにアイコンは変わるべきだし、移動開始した途端移動できる領域を分かりやすくすべし

改善できしだい本線に入れるけどね。
(このパッチは、こんな試みをしてみたいと思いますよ的な意思表明的なパッチであります)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment