acdh-oeaw / apis-acdhch-default-settings

Default settings for APIS instances at the ACDH
1 stars 0 forks source link

Document DJANGO_TABLES2_TEMPLATE setting for responsive tables #85

Open koeaw opened 8 months ago

koeaw commented 8 months ago

django-tables2's default template doesn't accommodate wide tables, but allows setting a different (global) template via the DJANGO_TABLES2_TEMPLATE variable, which affects the CSS of the table-container class.

It would be a good idea to document this, or maybe even consider what they propose in the docs:

If you use bootstrap 5 for your site, it makes sense to set the default to the bootstrap 5 template

and set this to the *-responsive.html template of whatever Bootstrap version we are using in APIS-Core and let users override this on an individual basis (should they really wish to).

Before
... table with lots of data/many columns spills over containing element: Screenshot 2024-02-29 at 17-11-32 Title Placeholder

After ... table can be scrolled thanks to overflow being added to container: Screenshot from 2024-02-29 17-17-08_crop

The latter was achieved by adding

DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap5-responsive.html"

to settings.

koeaw commented 8 months ago

Relatedly, it might make sense to provide defaults for DJANGO_TABLES2_TABLE_ATTRS for better accessibility.

E.g. when we last used webpage, our tables were set to be hoverable + striped by default (the docs give an example for the former, not the latter).

b1rger commented 8 months ago

It is already documented in the upstream django tables documentation, which is linked from our documentation. Do we have the resources to copy documentation from an upstream project and keep it up to date in our own documentation? Which of the settings of django-tables2, django-fitlersets, django-rest-framework, django crispy forms, django autocomplete light, reversion ... should we copy to our documentation?

koeaw commented 8 months ago

Which of the settings of django-tables2, django-fitlersets, django-rest-framework, django crispy forms, django autocomplete light, reversion ... should we copy to our documentation?

Probably everything that's relevant to UX/accessibility if we don't provide it ourselves, out of the box, tbqh.

sennierer commented 3 months ago

given that we dont need to update documentation, but might want to improve default settings for more sensible tables we moved the ticket here

koeaw commented 3 months ago

For reference, the django-tables2 settings we currently use in Frischmuth.