mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
BUGFIX: got drag and drop ordering of field OPTIONS rewritten in jQuery
This commit is contained in:
parent
c0b2f760cd
commit
e73015e6e5
@ -147,23 +147,50 @@
|
||||
/**
|
||||
* Sort Fields in the Field List
|
||||
*/
|
||||
$("#Fields_fields").sortable({
|
||||
handle : '.fieldHandler',
|
||||
cursor: 'pointer',
|
||||
items: 'li.EditableFormField',
|
||||
placeholder: 'removed-form-field',
|
||||
opacity: 0.6,
|
||||
revert: true,
|
||||
change : function (event, ui) {
|
||||
$("#Fields_fields").sortable('refreshPositions');
|
||||
},
|
||||
update : function (event, ui) {
|
||||
// get all the fields
|
||||
var sort = 1;
|
||||
$("li.EditableFormField").each(function() {
|
||||
$(this).find(".sortHidden").val(sort++);
|
||||
});
|
||||
}
|
||||
$("#Fields_fields").livequery(function() {
|
||||
$(this).sortable({
|
||||
handle : '.fieldHandler',
|
||||
cursor: 'pointer',
|
||||
items: 'li.EditableFormField',
|
||||
placeholder: 'removed-form-field',
|
||||
opacity: 0.6,
|
||||
revert: true,
|
||||
change : function (event, ui) {
|
||||
$("#Fields_fields").sortable('refreshPositions');
|
||||
},
|
||||
update : function (event, ui) {
|
||||
// get all the fields
|
||||
var sort = 1;
|
||||
$("li.EditableFormField").each(function() {
|
||||
$(this).find(".sortHidden").val(sort++);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Sort Options in a Field List - Such as options in a
|
||||
* dropdown field.
|
||||
*/
|
||||
$(".editableOptions").livequery(function() {
|
||||
$(this).sortable({
|
||||
handle : '.handle',
|
||||
cursor: 'pointer',
|
||||
items: 'li',
|
||||
placeholder: 'removed-form-field',
|
||||
opacity: 0.6,
|
||||
revert: true,
|
||||
change : function (event, ui) {
|
||||
$(this).sortable('refreshPositions');
|
||||
},
|
||||
update : function (event, ui) {
|
||||
// get all the fields
|
||||
var sort = 1;
|
||||
$(".editableOptions li").each(function() {
|
||||
$(this).find(".sortOptionHidden").val(sort++);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
|
@ -2,6 +2,7 @@
|
||||
<img class="handle" src="sapphire/images/drag.gif" alt="<% _t('DRAG', 'Drag to rearrange order of options') %>" />
|
||||
$DefaultSelect
|
||||
<input type="text" name="$Name.Attr[Title]" value="$Title" />
|
||||
<input type="hidden" class="sortOptionHidden" name="$Name[Sort]" value="$Sort" />
|
||||
|
||||
<% if isReadonly %>
|
||||
<img src="cms/images/locked.gif" alt="<% _t('LOCKED', 'These fields cannot be modified') %>" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user