11//= require 'jquery'
2+ //= require 'jquery-ui'
23//= require 'bootstrap'
34//= require 'cms/ajax'
45
@@ -9,16 +10,16 @@ var GlobalMenu = function() {
910} ;
1011
1112// Setting the 'New Page' path should update the global menu
12- GlobalMenu . prototype . addPagePath = function ( path ) {
13+ GlobalMenu . prototype . addPagePath = function ( path ) {
1314 $ ( '#new-content-button' ) . attr ( 'href' , path ) ;
1415 $ ( '.add-page-button' ) . attr ( 'href' , path ) ;
1516} ;
1617
17- GlobalMenu . prototype . addSectionPath = function ( path ) {
18+ GlobalMenu . prototype . addSectionPath = function ( path ) {
1819 $ ( '.add-link-button' ) . attr ( 'href' , path ) ;
1920} ;
2021
21- GlobalMenu . prototype . addLinkPath = function ( path ) {
22+ GlobalMenu . prototype . addLinkPath = function ( path ) {
2223 $ ( '.add-section-button' ) . attr ( 'href' , path ) ;
2324} ;
2425
@@ -29,7 +30,7 @@ var Sitemap = function() {
2930
3031// @return [Selector] The currently selected section in the sitemap. If a page or other child is selected, this will be
3132// that element's parent.
32- Sitemap . prototype . currentSection = function ( ) {
33+ Sitemap . prototype . currentSection = function ( ) {
3334 return $ ( this . selectedSection ) ;
3435} ;
3536
@@ -42,16 +43,15 @@ Sitemap.prototype.clearSelection = function() {
4243} ;
4344
4445// Different Content types have different behaviors when double clicked.
45- Sitemap . prototype . _doubleClick = function ( event ) {
46+ Sitemap . prototype . _doubleClick = function ( event ) {
4647 var type = $ ( event . target ) . data ( 'type' ) ;
47- switch ( type )
48- {
49- case 'section' :
50- case 'link' :
51- $ ( '#properties-button' ) [ 0 ] . click ( ) ;
52- break ;
53- default :
54- $ ( '#edit-button' ) [ 0 ] . click ( ) ;
48+ switch ( type ) {
49+ case 'section' :
50+ case 'link' :
51+ $ ( '#properties-button' ) [ 0 ] . click ( ) ;
52+ break ;
53+ default :
54+ $ ( '#edit-button' ) [ 0 ] . click ( ) ;
5555 }
5656} ;
5757
@@ -78,7 +78,7 @@ Sitemap.prototype.selectRow = function(row) {
7878} ;
7979
8080// Configure the 'New' button for content that is added directly to sections.
81- Sitemap . prototype . configureNewButton = function ( ) {
81+ Sitemap . prototype . configureNewButton = function ( ) {
8282 globalMenu . addPagePath ( this . currentSection ( ) . data ( 'add-page-path' ) ) ;
8383 globalMenu . addLinkPath ( this . currentSection ( ) . data ( 'add-link-path' ) ) ;
8484 globalMenu . addSectionPath ( this . currentSection ( ) . data ( 'add-section-path' ) ) ;
@@ -145,6 +145,15 @@ $(function() {
145145 } ) ;
146146 $ ( '.selectable' ) . on ( 'dblclick' , sitemap . _doubleClick ) ;
147147 sitemap . clickWebsite ( ) ;
148+ $ ( '#sitemap ul ul' ) . sortable ( {
149+ connectWith : '#sitemap ul ul' ,
150+ placeholder : 'ui-placeholder' ,
151+ delay : 250 ,
152+ start : function ( event , ui ) {
153+ sitemap . clearSelection ( ) ;
154+ }
155+ } ) ;
156+
148157} ) ;
149158
150159// Change the folder icon when they are opened/closed.
0 commit comments