diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-01-18 09:06:46 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-18 09:06:46 +0000 |
| commit | 8ec0e8471f424ead77a335277d86706c4b6d3add (patch) | |
| tree | 10ed731ec427af0982f2007ccdaeecdc685d06db /core/views | |
| parent | 9380e306f4e40da8f6d9a4e9cbe7231b7738ed60 (diff) | |
Drag and drop in the admin dashboard now saves the location.
* Make block_adder a real block
* Suppress the "close" link on block_adder
* Move the drag/drop JS into the core code out of the admin theme
Diffstat (limited to 'core/views')
| -rw-r--r-- | core/views/admin_dashboard.html.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/core/views/admin_dashboard.html.php b/core/views/admin_dashboard.html.php new file mode 100644 index 00000000..05fec643 --- /dev/null +++ b/core/views/admin_dashboard.html.php @@ -0,0 +1,38 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + update_blocks = function() { + $.get("<?= url::site("admin/dashboard/reorder") ?>", + {"csrf": "<?= access::csrf_token() ?>", + "dashboard_center[]": $("#gAdminDashboard").sortable( + "toArray", {attribute: "block_id"}), + "dashboard_sidebar[]": $("#gAdminDashboardSidebar").sortable( + "toArray", {attribute: "block_id"})}); + }; + + $(document).ready(function(){ + $("#gAdminDashboard .gBlock *:first").addClass("gDraggable"); + $("#gAdminDashboard").sortable({ + connectWith: ["#gAdminDashboardSidebar"], + containment: "document", + cursor: "move", + handle: $("div:first"), + opacity: 0.6, + placeholder: "gDropTarget", + stop: update_blocks + }); + + $("#gAdminDashboardSidebar .gBlock *:first").addClass("gDraggable"); + $("#gAdminDashboardSidebar").sortable({ + connectWith: ["#gAdminDashboard"], + containment: "document", + cursor: "move", + handle: $("div:first"), + opacity: 0.6, + placeholder: "gDropTarget", + stop: update_blocks + }); + }); +</script> +<div id="gAdminDashboard"> + <?= $blocks ?> +</div> |
