}
function openblock(bid) {
- $('span.menublock').hide();
- $('#' + bid).fadeIn('fast');
+ if (!resequencing) {
+ $('span.menublock').hide();
+ $('#' + bid).fadeIn('fast');
+ }
}
$(init_blocks);
// fixme, I need to rename menublocks.js to something more like
// 'course-item-stuff.js'.
-// this is some item reordering code.
+// this is some item resequencing code.
-var reordering = false;
+var resequencing = false;
-function doReorder() {
- if (!reordering) {
- $('.itemtree').sortable({axis:'y'});
- $('.an_item').css({ marginTop: '20px' });
- $('#reorder_panel').after($('#ropanelmessage'));
- $('#reorder_panel a').text($('#i18n-save-order').text());
- reordering = true;
+function doResequence() {
+ if (!resequencing) {
+ $('.itemtree:nth(0)').sortable({axis:'y'});
+ $('.itemtree:nth(0) > .an_item').addClass('sort_item');
+ $('#resequence_panel').after($('#ropanelmessage'));
+ $('#resequence_panel a').text($('#i18n-save-order').text());
+ resequencing = true;
} else {
- $('.an_item').css({ marginTop: '4px' });
+ $('.an_item').removeClass('sort_item');
$('#ropanelmessage').remove();
- $('#reorder_panel a').text('...');
+ $('#resequence_panel a').text('...');
$('.itemtree').sortable('destroy');
- reordering = false;
+ resequencing = false;
// get the LI item ids. Send them to the server.
var new_sequence = $('.an_item').map(function() { return $(this).attr('id') });
var new_seq_string = Array.join(new_sequence, ',');
$.post('reseq', {'new_order':new_seq_string},
function() {
- $('#reorder_panel a').text($('#i18n-reorder-items').text());
+ $('#resequence_panel a').text($('#i18n-resequence-items').text());
alert($('#i18n-new-order-saved').text());
});
}
</div>
</div>
- <div py:def="item_reorder_panel()" py:strip="True">
- <div id="reorder_panel" class="little_action_panel">
- <a href="javascript:doReorder();">Reorder items</a>
+ <div py:def="item_resequence_panel()" py:strip="True">
+ <div id="resequence_panel" class="little_action_panel">
+ <a href="javascript:doResequence();">Resequence items</a>
</div>
<div style="display: none;">
- <span id="i18n-save-order">Save Ordering</span>
- <span id="i18n-reorder-items">Reorder Items</span>
- <span id="i18n-new-order-saved">The new ordering has been saved.</span>
+ <span id="i18n-save-order">Save Sequence</span>
+ <span id="i18n-resequence-items">Resequence Items</span>
+ <span id="i18n-new-order-saved">The new sequence has been saved.</span>
<div id="ropanelmessage" style="clear: right; width: 10em;"
- class="little_action_panel">Drag the items around. Then click Save Ordering, above.</div>
+ class="little_action_panel">Drag the items around. Then click Save Sequence, above.</div>
</div>
</div>
<div py:if="instructs(request.user, course)" id="edit_course" class="little_action_panel">
<a href="${course.course_url()}edit/">Edit course details</a>
</div>
- ${item_reorder_panel()}
+ ${item_resequence_panel()}
${show_tree(item_tree, edit=is_editor)}
<div py:if="is_editor">${add_subs()}</div>