update position attributes when reordering module items

if you dragged a module item below another one and then
indented it, it would jump up to where it used to be
in the list.

fixes #3716

Change-Id: Ic3c5cbdc028f4976bbc55e006a454c4a266f48bf
Reviewed-on: https://gerrit.instructure.com/2204
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
This commit is contained in:
Brian Whitmer 2011-02-08 11:58:27 -07:00
parent 878a0cf2a7
commit c819d861b7
1 changed files with 8 additions and 0 deletions

View File

@ -379,6 +379,14 @@ var modules = (function() {
});
$.ajaxJSON(url, 'POST', {order: items.join(",")}, function(data) {
$module.find(".content").loadingImage('remove');
if(data && data.context_module && data.context_module.content_tags) {
for(var idx in data.context_module.content_tags) {
var tag = data.context_module.content_tags[idx].content_tag;
$module.find("#context_module_item_" + tag.id).fillTemplateData({
data: {position: tag.position}
});
}
}
}, function(data) {
$module.find(".content").loadingImage('remove');
$module.find(".content").errorBox('Reorder failed, please try again.');