From 83f28a24a65a0765d285c40de81be3b4cb727593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 24 Oct 2016 21:18:51 +0200 Subject: [PATCH] admin: add ellipsis at the end of data source preview (#13725) --- tests/test_admin_pages.py | 7 +++++++ wcs/admin/data_sources.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/tests/test_admin_pages.py b/tests/test_admin_pages.py index 27195f5..bcf88af 100644 --- a/tests/test_admin_pages.py +++ b/tests/test_admin_pages.py @@ -3369,6 +3369,13 @@ def test_data_sources_view(pub): assert 'Preview' in resp.body assert 'foo' in resp.body + data_source.data_source = {'type': 'formula', 'value': '[str(x) for x in range(100)]'} + data_source.store() + resp = app.get('/backoffice/settings/data-sources/%s/' % data_source.id) + assert 'Preview' in resp.body + assert resp.body.count('
  • ') < 100 + assert '
  • ...
  • ' in resp.body + def test_data_sources_edit(pub): create_superuser(pub) NamedDataSource.wipe() diff --git a/wcs/admin/data_sources.py b/wcs/admin/data_sources.py index 2c1939a..afc4e84 100644 --- a/wcs/admin/data_sources.py +++ b/wcs/admin/data_sources.py @@ -138,6 +138,8 @@ class NamedDataSourcePage(Directory): else: r += htmltext('
  • %s: %s
  • ') % ( item.get('id'), item.get('text')) + if len(items) > 10: + r += htmltext('
  • ...
  • ') r += htmltext('') else: # the data source field is required so this should never happen -- 2.10.1