summaryrefslogtreecommitdiff
path: root/themes/admin_default/js/ui.init.js
blob: 23d6cdeaece2dbba2f59a925ce13d798ecf71cf0 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
$(document).ready(function(){
  // Add Superfish menu class
  $("#gSiteAdminMenu ul.gMenu").addClass("sf-menu");
  $("ul.gMenu").addClass("sf-menu");

  // Superfish menu options
  $('ul.sf-menu').superfish({
    delay: 500,
    animation: {
      opacity: 'show',
      height: 'show'
    },
    pathClass: 'current',
    speed: 'fast'
  });

  // Apply modal dialogs
  var dialogLinks = $(".gDialogLink");
  for (var i=0; i < dialogLinks.length; i++) {
    $(dialogLinks[i]).bind("click", {element: dialogLinks[i]}, handleDialogEvent);
  }

  $("#gThemeDetailsForm").ajaxForm({
    dataType: "json",
    success: function(body, result, set) {
      if (body.result == "success") {
        $("#gMessage").append("<span class='gSuccess'>" + body.message + "</span>");
      } else {
        $("#gMessage").append("<span class='gError'>" + body.message + "</span>");
      }
    }
  });

  // Sortable dashboard blocks
  if ($(".ui-dialog-titlebar-close").length) {
    $(".gBlock *:first").addClass("gDraggable");
    $("#gContent").sortable({
      connectWith: ["#gSidebar"],
      cursor: "move",
      handle: $("div:first"),
      opacity: 0.6,
      placeholder: "gDropTarget",
      update: function() { console.log($(this).sortable("serialize")); }
      // @todo stop: function() { .ajax() }
    });
    $("#gSidebar").sortable({
      connectWith: ["#gContent"],
      containment: "document",
      cursor: "move",
      handle: $("div:first"),
      opacity: 0.6,
      placeholder: "gDropTarget",
      update: function() { console.log($(this).sortable("serialize")); }
      // @todo stop: function() { .ajax() }
    });
  }
});