Improve List Sorting UI (#4215)

Improve product list UI (allow move between categories, more useful columns and links)
and hide "move up/down" arrows in lists by default if drag-drop is available
This commit is contained in:
Mira
2024-06-25 12:54:11 +02:00
committed by GitHub
parent 043e2eb9cf
commit a73c4ad937
11 changed files with 176 additions and 75 deletions

View File

@@ -402,6 +402,24 @@ class ItemsTest(ItemFormTest):
self.item2.refresh_from_db()
assert self.item1.position < self.item2.position
def test_reorder(self):
self.client.post('/control/event/%s/%s/items/reorder/0/' % (self.orga1.slug, self.event1.slug), {
'ids': [str(self.item2.id), str(self.item1.id)],
}, content_type='application/json')
self.item1.refresh_from_db()
self.item2.refresh_from_db()
assert self.item1.position > self.item2.position
assert self.item1.category is None
assert self.item2.category is None
self.client.post('/control/event/%s/%s/items/reorder/%s/' % (self.orga1.slug, self.event1.slug, self.addoncat.id), {
'ids': [str(self.item1.id), str(self.item2.id)],
}, content_type='application/json')
self.item1.refresh_from_db()
self.item2.refresh_from_db()
assert self.item1.position < self.item2.position
assert self.item1.category.id == self.addoncat.id
assert self.item2.category.id == self.addoncat.id
def test_create(self):
self.client.post('/control/event/%s/%s/items/add' % (self.orga1.slug, self.event1.slug), {
'name_0': 'T-Shirt',

View File

@@ -323,7 +323,7 @@ event_permission_urls = [
("can_change_items", "items/add", 200, HTTP_GET),
("can_change_items", "items/1/up", 404, HTTP_POST),
("can_change_items", "items/1/down", 404, HTTP_POST),
("can_change_items", "items/reorder", 400, HTTP_POST),
("can_change_items", "items/reorder/2/", 400, HTTP_POST),
("can_change_items", "items/1/delete", 404, HTTP_GET),
# ("can_change_items", "categories/", 200),
# We don't have to create categories and similar objects