-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add multi-record support to attributes_table_for #2544
Add multi-record support to attributes_table_for #2544
Conversation
💙 But do you really think |
Were you thinking of something like this? table_for collection, by: :row do
field :id
field :name
end or maybe this? table_for collection, display: :attributes do; end
table_for collection, display: :columns do; end
table_for collection, display: :rows do; end # <= the default behavior What would be the best approach for moving to a new API like this? Provide deprecated aliases for the existing API? |
What would I think I'm in favor of Yeah, the idea is we'd keep aliases for the existing API for at least the next release. If we're going to merge these, I'm still conflicted on the |
I like to try all possible names to see which would be the best. Display I think this new API would take the form: table_for collection do
column :name
end
table_for collection, display: :columns do
row :name
end The calls There is still potential for confusion. If a user wants to change the table format to be displayed by rows; she converts all the |
Maybe if you're using row or column in the wrong table, we could raise an exception. On Oct 8, 2013, at 8:12 AM, Charles Maresh [email protected] wrote:
|
A more intuitive solution would be to display the table by columns if all the calls are |
I think I'm with @zorab47 on this one. table_for collection do
row :id
row :name
row :created_at
end
table_for collection do
column :id
column :name
column :created_at
end Feels much more intuitive. In fact I'm pretty sure I've absent-mindedly tried to do this on multiple occasions. I'd also vote for |
I'm not sure how we'll deal with the built in It should probably be its own PR though, after this one. Do you agree @zorab47? If so, I'll merge this one. |
@daxter I'm good with that approach. |
TIL |
Yeah, I don't think |
Add multi-record support to attributes_table_for
Thanks for the contribution! 🐼 |
@zorab47 are you planning on implementing the new |
@daxter it is your call. I won't have time to dedicate to it until this coming weekend. |
Allow multiple records to be displayed in columns using the ActiveAdmin
attribute_table_for
component, while staying backward compatible with the previous behavior. It also builds acolgroup
andcol
elements to facilitate styling each record's table column, but only when a collection is provided.The PR is a result of discussions in #2540.