Since now poll question answers have been renamed to poll question options, using HTML IDs, classes and data attributes named `answer` was confusing.
23 lines
488 B
JavaScript
23 lines
488 B
JavaScript
(function() {
|
|
"use strict";
|
|
App.Sortable = {
|
|
initialize: function() {
|
|
$(".sortable").sortable({
|
|
update: function() {
|
|
var new_order;
|
|
new_order = $(this).sortable("toArray", {
|
|
attribute: "data-option-id"
|
|
});
|
|
$.ajax({
|
|
url: $(this).data("js-url"),
|
|
data: {
|
|
ordered_list: new_order
|
|
},
|
|
type: "POST"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
};
|
|
}).call(this);
|