diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-30 14:25:33 -0700 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-30 14:26:32 -0700 |
| commit | 4de412e72270587cbd656ebafe08892344055a4d (patch) | |
| tree | a536c7965efa112b82ab18a35da49d8f239fb8fc /modules/gallery/views | |
| parent | 19b875723b37ac7121c64c0c882ccbc2e6353d08 (diff) | |
Enable the administration screen for the sidebar. Fix for ticket #110.
Diffstat (limited to 'modules/gallery/views')
| -rw-r--r-- | modules/gallery/views/admin_sidebar.html.php | 47 | ||||
| -rw-r--r-- | modules/gallery/views/admin_sidebar_blocks.html.php | 5 |
2 files changed, 47 insertions, 5 deletions
diff --git a/modules/gallery/views/admin_sidebar.html.php b/modules/gallery/views/admin_sidebar.html.php index 32386f5d..62b59ac1 100644 --- a/modules/gallery/views/admin_sidebar.html.php +++ b/modules/gallery/views/admin_sidebar.html.php @@ -1,9 +1,46 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> - -<h1> <?= t("Arrange Sidebar") ?> </h1> +<script type="text/javascript"> + $(function() { + $(".gAdminBlocksList ul").sortable({ + connectWith: ".sortableBlocks", + opacity: .7, + placeholder: "ui-state-highlight", + update: function(event,ui) { + if ($(this).attr("id") == "gActiveBlocks") { + var active_blocks = ""; + $("ul#gActiveBlocks li").each(function(i) { + active_blocks += "&block["+i+"]="+$(this).attr("ref"); + }); + $.getJSON($("#gSiteBlocks").attr("ref").replace("__ACTIVE__", active_blocks), function(data) { + if (data.result == "success") { + $("ul#gAvailableBlocks").html(data.available); + $("ul#gActiveBlocks").html(data.active); + } + }); + } + }, + }).disableSelection(); + }); +</script> +<h1> <?= t("Manage Sidebar") ?> </h1> <p> <?= t("Select and drag blocks from the available column to the active column to add to the sidebar; remove by dragging the other way.") ?> </p> - -<div id="gSiteBlocks"> -</div>
\ No newline at end of file + <div id="gSiteBlocks" ref="<?= url::site("admin/sidebar/update?csrf={$csrf}__ACTIVE__") ?>"> + <div class="gAdminBlocksList"> + <div><h3><?= t("Available Blocks") ?></h3></div> + <div> + <ul id="gAvailableBlocks" class="sortableBlocks"> + <?= $available ?> + </ul> + </div> + </div> + <div class="gAdminBlocksList"> + <div><h3><?= t("Active Blocks") ?></h3></div> + <div> + <ul id="gActiveBlocks" class="sortableBlocks"> + <?= $active ?> + </ul> + </div> + </div> +</div> diff --git a/modules/gallery/views/admin_sidebar_blocks.html.php b/modules/gallery/views/admin_sidebar_blocks.html.php new file mode 100644 index 00000000..a1a71743 --- /dev/null +++ b/modules/gallery/views/admin_sidebar_blocks.html.php @@ -0,0 +1,5 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> + +<? foreach ($blocks as $ref => $text): ?> +<li class="gDraggable" ref="<?= $ref ?>"><?= $text ?></li> +<? endforeach ?> |
