Hook up reordering children in the browser.
* NOTE: the new order is NOT saved to the server!
This commit is contained in:
@@ -13,6 +13,16 @@ class CMS.Views.ModuleEdit extends Backbone.View
|
|||||||
|
|
||||||
# Load preview modules
|
# Load preview modules
|
||||||
XModule.loadModules('display')
|
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) ->
|
save: (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
@@ -32,6 +42,7 @@ class CMS.Views.ModuleEdit extends Backbone.View
|
|||||||
cancel: (event) ->
|
cancel: (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
CMS.popView()
|
CMS.popView()
|
||||||
|
@enableDrag()
|
||||||
|
|
||||||
editSubmodule: (event) ->
|
editSubmodule: (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
@@ -42,3 +53,4 @@ class CMS.Views.ModuleEdit extends Backbone.View
|
|||||||
id: $(event.target).data('id')
|
id: $(event.target).data('id')
|
||||||
type: if moduleType == 'None' then null else moduleType
|
type: if moduleType == 'None' then null else moduleType
|
||||||
previewType: if previewType == 'None' then null else previewType
|
previewType: if previewType == 'None' then null else previewType
|
||||||
|
@enableDrag()
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<section class="modules">
|
<section class="modules">
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<ol>
|
<ol id="sortable">
|
||||||
% for child in module.get_children():
|
% for child in module.get_children():
|
||||||
<li class="${module.category}">
|
<li class="${module.category}">
|
||||||
<a href="#" class="module-edit"
|
<a href="#" class="module-edit"
|
||||||
|
|||||||
Reference in New Issue
Block a user