summaryrefslogtreecommitdiff
path: root/modules/gallery/views/admin_dashboard.html.php
blob: f391547e40fc7effad01e2bc3e9f113ff21d7735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript">
  update_blocks = function() {
    $.get(<?= html::js_string(url::site("admin/dashboard/reorder")) ?>,
          {"csrf": "<?= $csrf ?>",
           "dashboard_center[]": $("#g-admin-dashboard").sortable(
             "toArray", {attribute: "block_id"}),
           "dashboard_sidebar[]": $("#g-admin-dashboard-sidebar").sortable(
             "toArray", {attribute: "block_id"})});
  };

  $(document).ready(function(){
    $("#g-admin-dashboard .g-block .ui-widget-header").addClass("g-draggable");
    $("#g-admin-dashboard").sortable({
      connectWith: ["#g-admin-dashboard-sidebar"],
      cursor: "move",
      handle: $(".ui-widget-header"),
      opacity: 0.6,
      placeholder: "g-target",
      stop: update_blocks
    });

    $("#g-admin-dashboard-sidebar .g-block .ui-widget-header").addClass("g-draggable");
    $("#g-admin-dashboard-sidebar").sortable({
      connectWith: ["#g-admin-dashboard"],
      cursor: "move",
      handle: $(".ui-widget-header"),
      opacity: 0.6,
      placeholder: "g-target",
      stop: update_blocks
    });
  });
</script>
<div id="g-admin-dashboard">
  <?= $blocks ?>
</div>