[dw-free] Revamp /update
[commit: http://hg.dwscoalition.org/dw-free/rev/3b4fffc1714a]
http://bugs.dwscoalition.org/show_bug.cgi?id=2524
Enforce loading order of the lazy-loaded JS files, so that sortable
(hopefully) works.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2524
Enforce loading order of the lazy-loaded JS files, so that sortable
(hopefully) works.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- htdocs/js/jquery.postoptions.js
- views/entry/options.tt
-------------------------------------------------------------------------------- diff -r 143caca9524b -r 3b4fffc1714a htdocs/js/jquery.postoptions.js --- a/htdocs/js/jquery.postoptions.js Mon Oct 31 20:05:58 2011 +0800 +++ b/htdocs/js/jquery.postoptions.js Mon Oct 31 21:14:39 2011 +0800 @@ -69,7 +69,16 @@ $(".panels-list").append("<p class='note'>Scroll down to arrange panels to your preference</p>") + if ($(".sortable_column_text").length == 0) { + $.getScript(Site.siteroot + "/js/jquery/jquery.ui.mouse.min.js", + function() { $.getScript(Site.siteroot + "/js/jquery/jquery.ui.sortable.min.js", + setupSortable + ) } + ); +} + +function setupSortable() { var $draginstructions = $("<div class='sortable_column_text'>drag and drop to rearrange</div>").disableSelection(); $(".column").sortable({ @@ -79,15 +88,15 @@ opacity: 0.8, cancel: ".sortable_column_text" }) - .sortable( "disable" ) + .sortable( "enable" ).disableSelection() .append($draginstructions); } - startEditing(); function stopEditing() { - $(".column").sortable( "disable" ).enableSelection(); + if ( $.fn.sortable ) + $(".column").sortable( "disable" ).enableSelection(); $(document.body).removeClass("screen-customize-mode"); $("#post_entry").addClass("minimal"); @@ -95,7 +104,8 @@ } function startEditing() { - $(".column").sortable( "enable" ).disableSelection(); + if ( $.fn.sortable ) + $(".column").sortable( "enable" ).disableSelection(); $(document.body).addClass("screen-customize-mode"); $("#post_entry").removeClass("minimal"); diff -r 143caca9524b -r 3b4fffc1714a views/entry/options.tt --- a/views/entry/options.tt Mon Oct 31 20:05:58 2011 +0800 +++ b/views/entry/options.tt Mon Oct 31 21:14:39 2011 +0800 @@ -125,8 +125,6 @@ <link rel="stylesheet" type="text/css" href="[%site.statroot%]/simple-form.css"> <link rel="stylesheet" type="text/css" href="[%site.statroot%]/jquery.postoptions.css"> -<script type="text/javascript" src="[%site.jsroot%]/jquery/jquery.ui.mouse.min.js"></script> -<script type="text/javascript" src="[%site.jsroot%]/jquery/jquery.ui.sortable.min.js"></script> <script type="text/javascript" src="[%site.jsroot%]/jquery.postoptions.js"></script> [%- ELSE -%] --------------------------------------------------------------------------------