Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix sortables code style to match ES6

dominik-zeglen2e2ba4fae606
diff --git a/saleor/static/dashboard/js/components/sortable.js b/saleor/static/dashboard/js/components/sortable.js
index 1789196836..c7d0bbdaea 100644
--- a/saleor/static/dashboard/js/components/sortable.js
+++ b/saleor/static/dashboard/js/components/sortable.js
@@ -1,21 +1,22 @@
import Sortable from 'sortablejs';
-$('.sortable-items').each(function() {
- Sortable.create(this, {
+$('.sortable-items').each((sortableIndex, sortableItems) => {
+ const sortable = $(sortableItems);
+ Sortable.create(sortableItems, {
handle: '.sortable__drag-area',
animation: 150,
onUpdate: () => {
- const sortedItems = $(this)
+ const sortedItems = sortable
.find('.sortable-item[data-id]')
.map((index, item) => item.dataset.id)
.toArray();
const data = {};
- data[$(this).data('post-name')] = sortedItems;
+ data[sortable.data('post-name')] = sortedItems;
// TODO: Get rid of ajax() in favour of fetch()
$.ajax({
method: 'POST',
- url: $(this).data('post-url'),
+ url: sortable.data('post-url'),
data: data,
traditional: true,
headers: {