Kreyu/data-table-bundle

Refactor built-in themes for easier usage

Opened this issue · 2 comments

Twig themes are a bit chaotic in some parts, with unnecessary blocks, weird attribute inheritance, etc. This has to be done before first stable release to prevent additional work with previously created custom themes.

Hello @Kreyu !

When you say you want to delete unnecessary blocks, are you referring to this:

  • kreyu_data_table | kreyu_data_table_table | table | kreyu_data_table_form_aware
  • kreyu_data_table_action_bar | action_bar
  • kreyu_data_table_header_row | table_head_row

What surprises me in the way the views are divided is that sometimes we directly use the twig blocks {{ block('table') }} and sometimes we use the extension functions {{ data_table_pagination(pagination) }}.

Shouldn't we have something more uniform?
Shouldn't the DataTableView prepare everything for display and therefore not go through the twig extension?

Have a good day,
Alexandre

When you say you want to delete unnecessary blocks, are you referring to this:

kreyu_data_table | kreyu_data_table_table | table | kreyu_data_table_form_aware
kreyu_data_table_action_bar | action_bar
kreyu_data_table_header_row | table_head_row

Exactly. Most of those blocks are unnecessary, and provide no real benefit.

  • instead of kreyu_data_table_table, use a simple table;
  • instead of kreyu_data_table_pagination, use a simple pagination;
  • etc.

What surprises me in the way the views are divided is that sometimes we directly use the twig blocks {{ block('table') }} and sometimes we use the extension functions {{ data_table_pagination(pagination) }}.

Yeah, that seems a bit weird. There's plenty of twig functions that allow rendering each part of the data table individually - just like in Symfony Form you can render label, widget, help message and errors separately. I think this is fine. Those functions however, should render different blocks - for example, instead of using kreyu_data_table_table block, just a simple table should be sufficient. Not sure whether the built-in themes should use the functions, or their blocks directly.

I think most of the work with refactoring has already be done in base theme, now I'm adjusting and ironing out the Bootstrap and Tabler themes.