BUGFIX: refresh sortable lists after adding elements

This commit is contained in:
Will Rossiter 2010-05-31 09:43:52 +00:00
parent a63089b817
commit 7491e5c9e9

View File

@ -64,6 +64,9 @@
statusMessage(ss.i18n._t('UserForms.ERRORCREATINGFIELD', 'Error Creating Field')); statusMessage(ss.i18n._t('UserForms.ERRORCREATINGFIELD', 'Error Creating Field'));
} }
}); });
$("#Fields_fields").sortable("refresh");
return false; return false;
}); });
@ -86,7 +89,6 @@
* currently have it open * currently have it open
*/ */
$(".EditableFormField .moreOptions").live('click',function() { $(".EditableFormField .moreOptions").live('click',function() {
var parentID = $(this).parents(".EditableFormField"); var parentID = $(this).parents(".EditableFormField");
if(parentID) { if(parentID) {
var extraOptions = parentID.children(".extraOptions"); var extraOptions = parentID.children(".extraOptions");
@ -125,7 +127,9 @@
} }
} }
}); });
$(this).parents(".EditableFormField").remove(); $(this).parents(".EditableFormField").remove();
return false; return false;
}); });
@ -204,8 +208,7 @@
* Sort Options in a Field List - Such as options in a * Sort Options in a Field List - Such as options in a
* dropdown field. * dropdown field.
*/ */
$(".editableOptions").live(function() { $(".editableOptions").sortable({
$(this).sortable({
handle : '.handle', handle : '.handle',
cursor: 'pointer', cursor: 'pointer',
items: 'li', items: 'li',
@ -223,7 +226,6 @@
}); });
} }
}); });
});
/** /**
* Custom Rules Interface * Custom Rules Interface
@ -250,8 +252,7 @@
/** /**
* Adding a custom rule to a given form * Adding a custom rule to a given form
*/ */
$(".customRules .addCondition").live('click', function() { $(".customRules .addCondition").click(function() {
// Give the user some feedback // Give the user some feedback
statusMessage(ss.i18n._t('UserForms.ADDINGNEWRULE', 'Adding New Rule')); statusMessage(ss.i18n._t('UserForms.ADDINGNEWRULE', 'Adding New Rule'));
@ -281,6 +282,8 @@
// append to the list // append to the list
currentRules.append(newRule); currentRules.append(newRule);
$(".editableOptions").sortable("refresh");
return false; return false;
}); });
}); });