-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Resource Table Component #2972
Resource Table Component #2972
Conversation
Reopend #2785, Github can't reopen a PR, if the branch was forced pushed... |
6e36c25
to
5ce71c7
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2972 +/- ##
==========================================
+ Coverage 96.44% 96.46% +0.01%
==========================================
Files 233 237 +4
Lines 6307 6392 +85
==========================================
+ Hits 6083 6166 +83
- Misses 224 226 +2 ☔ View full report in Codecov by Sentry. |
5ce71c7
to
8ec6171
Compare
d32458c
to
d25861d
Compare
d25861d
to
42b9b3c
Compare
56582a5
to
0b3b09a
Compare
0b3b09a
to
8deb5ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work 🍰
Some minor questions
8deb5ee
to
8688b13
Compare
Add first try of a resource table. It is pretty raw and does not create the right output, but it is only a proposal.
Use the resource table - component for the default resource views.
Use the new table component for the language index - view and remove the old implementation.
Draw a check - icon if the value is boolean and is truthy. This was done previously in the view, but it is now easier to reuse these behavior in the table component.
The params - hash is at least in test environments not always set and it is better to use the default Rails methods to get the path to the controller.
8688b13
to
70ab4d7
Compare
The implementation is pretty verbose, because the table itself has a lot of extra functionalities. It is not possible to use the default delete and edit buttons, because of different redirect links in the button configuration.
Use the new table component also for the page table. This table also has a lot of custom logic inside, that makes the configuration a bit verbose.
Use the new table component to render the tags table. The CSS had to be adjusted to change the width of the table columns.
Move the Button configuration into an own component and use the many slot mechanic of ViewComponent to render each container for each button.
70ab4d7
to
c1068ce
Compare
module Alchemy | ||
module Admin | ||
module Resource | ||
# Renders a container for a button, which evaluate CanCanCan and shows a tooltip. This |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment seems to be wrong
Use more view components to simplify the table and make it more readable. This also improves the before_render - method in the table. The content - "hack" is now not necessary anymore, because the view_context isn't used anymore and all other view components are placed as slots in the table.
The button method was a bit misleading, because it was providing only a container for a button. It now uses the with_action method, which is provided by the ViewComponent slot.
The variable is representing the header text of the column and is way easier to understand than the name label.
c1068ce
to
026ed13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, awesome work @kulturbande 🥳
What is this pull request for?
Add an experimental resource table component. The idea is to make it easier to create resource tables without duplicating the table structure and be in sync between the index view and the row partial.
All tables (except page nodes table in page dialog) are using the page component. It works the same way as before, but it should be easier to create new resource views and maybe we can extend the behavior to provide other views (e.g. grid view).
Screenshots
An example:
Checklist