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:
Simon Willison 2018-04-09 17:30:44 -07:00
commit 57b19f09d1
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
4 changed files with 46 additions and 5 deletions

View file

@ -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']),