From 523cb334a02fffc9c4455b9ecffd8e08cea04a85 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Wed, 8 Aug 2012 13:10:07 -0400 Subject: [PATCH] Hook up reordering children in the browser. * NOTE: the new order is NOT saved to the server! --- cms/static/coffee/src/views/module_edit.coffee | 12 ++++++++++++ cms/templates/widgets/sequence-edit.html | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index d47bc3a90c..d212f7cb17 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -13,6 +13,16 @@ class CMS.Views.ModuleEdit extends Backbone.View # Load preview modules XModule.loadModules('display') + @enableDrag() + + enableDrag: -> + # Enable dragging things in the #sortable div (if there is one) + if $("#sortable").length > 0 + $("#sortable").sortable({ + placeholder: "ui-state-highlight" + }) + $("#sortable").disableSelection(); + save: (event) -> event.preventDefault() @@ -32,6 +42,7 @@ class CMS.Views.ModuleEdit extends Backbone.View cancel: (event) -> event.preventDefault() CMS.popView() + @enableDrag() editSubmodule: (event) -> event.preventDefault() @@ -42,3 +53,4 @@ class CMS.Views.ModuleEdit extends Backbone.View id: $(event.target).data('id') type: if moduleType == 'None' then null else moduleType previewType: if previewType == 'None' then null else previewType + @enableDrag() diff --git a/cms/templates/widgets/sequence-edit.html b/cms/templates/widgets/sequence-edit.html index c623eb4ec2..d92ccbb7a7 100644 --- a/cms/templates/widgets/sequence-edit.html +++ b/cms/templates/widgets/sequence-edit.html @@ -33,7 +33,7 @@
  1. -
      +
        % for child in module.get_children():