mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Ability to sort using form fields (for mobile portrait mode)
We now display sort options as a select box plus a descending checkbox, which means you can apply sort orders even in portrait mode on a mobile phone where the column headers are hidden. Closes #199
This commit is contained in:
parent
67982b6ecb
commit
57b19f09d1
4 changed files with 46 additions and 5 deletions
|
|
@ -135,6 +135,19 @@ def test_empty_search_parameter_gets_removed(app_client):
|
|||
)
|
||||
|
||||
|
||||
def test_sort_by_desc_redirects(app_client):
|
||||
path_base = app_client.get(
|
||||
'/test_tables/sortable', allow_redirects=False, gather_request=False
|
||||
).headers['Location']
|
||||
path = path_base + '?' + urllib.parse.urlencode({
|
||||
'_sort': 'sortable',
|
||||
'_sort_by_desc': '1',
|
||||
})
|
||||
response = app_client.get(path, allow_redirects=False, gather_request=False)
|
||||
assert response.status == 302
|
||||
assert response.headers['Location'].endswith('?_sort_desc=sortable')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('path,expected_classes', [
|
||||
('/', ['index']),
|
||||
('/test_tables', ['db', 'db-test_tables']),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue