Skip to content

Commit

Permalink
SAK-31969 re-do reordering in Resources to use jquery-ui keyboardSort…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
ottenhoff committed Aug 2, 2017
1 parent 7d8d1a7 commit c9b8307
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
## version: $Id: $
<!-- chef_resources_reorder.vm, use with org.sakaiproject.tool.content.ResourcesAction.java -->
<!-- this is the reorder template -->
#javascript("/library/js/fluid/1.5/MyInfusion.js")
#javascript("/library/js/reorderer.js")

<div class="portletBody specialLink">
<form name="reorderForm" id="reorderForm" action="#toolForm("ResourcesAction")" method="post">
Expand Down Expand Up @@ -52,7 +50,7 @@
#set($collectionMembers = $root.members)
#set($count = 1)
#foreach($member in $collectionMembers)
<li class="sortable row well" id="listitem.orderable$count">
<li class="sortable row well" tabindex="0" id="listitem.orderable$count">
<span style="display:none" class="grabHandle">
<input type="text" size="3" value="$count" id="index$count"/>
<input type="hidden" size="3" id="holder$count" value="$count" tabindex="-2"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Sakai jQuery keyboard sortable from https://raw.githubusercontent.com/hanshillen/sakai-keyboardsortable/master/js/jquery.sakai.js
*/

$(function() {
$PBJQ(document).ready(function() {
var _defaults = {
/* strings */
dragModeStartMsg : "drag start, Use U and D keys to move the item up and down",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$(document).ready(function(){
$PBJQ(document).ready(function(){
if ($("#reorder-list li").size() - 1 > 15) {
$('.grabHandle').show();
$('#inputFieldMessage').show();
$('#inputKbdMessage').remove();
$('#inputKbdMessage').remove();
}
//get the initial order TODO - make an array instead of putting the values in a span
$('#reorder-list li').each(function(n){
Expand Down Expand Up @@ -117,17 +117,16 @@ $(document).ready(function(){
registerChange('notfluid', $(this).parents('li'));
});

// the standard Fluid initialization
var opts = {
selectors: {
movables: '[id^="listitem.orderable"]'
},
listeners: {
onBeginMove: preserveStatus,
afterMove: registerChange
}
};
return fluid.reorderList("#reorder-list", opts);
// the jquery-ui sortable initialization
return $PBJQ("#reorder-list").keyboardSortable({
items: '[id^="listitem.orderable"]',
start: function( event, ui ) {
preserveStatus(ui);
},
update: function( event, ui ) {
registerChange(event, ui);
},
});
});


Expand Down

0 comments on commit c9b8307

Please sign in to comment.