Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor built-in themes for easier usage #91

Open
Tracked by #95
Kreyu opened this issue May 17, 2024 · 2 comments
Open
Tracked by #95

Refactor built-in themes for easier usage #91

Kreyu opened this issue May 17, 2024 · 2 comments
Assignees
Labels
enhancement Something that would make existing features better

Comments

@Kreyu
Copy link
Owner

Kreyu commented May 17, 2024

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.

@Kreyu Kreyu self-assigned this May 17, 2024
@Kreyu Kreyu added the enhancement Something that would make existing features better label May 17, 2024
@alexandre-castelain
Copy link
Contributor

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

@Kreyu
Copy link
Owner Author

Kreyu commented Jun 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something that would make existing features better
Projects
None yet
Development

No branches or pull requests

2 participants