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

Unify specifying label in show -> attributes_table #5661

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mirelon
Copy link
Contributor

@mirelon mirelon commented Jan 15, 2019

Up to now, the only way to specify a label in a row in attributes_table was by using the first argument. The data was then taken from executing a block:

attributes_table do
  row 'Renamed' do |r|
    r.username
  end
end

This pull request allows for syntax:

attributes_table do
  row 'Renamed', :username
end

The same syntax is used by index:

index do
    column 'Renamed', :username
end

Closes #3359, closes #167

@mingchang
Copy link

mingchang commented Mar 26, 2020

So this has been sitting around for a year due to an extra space in the pull request?

lib/active_admin/views/components/attributes_table.rb:25:13: C: Layout/ExtraSpacing: Unnecessary spacing detected.
        data  = args[1] || args[0]
            ^

355 files inspected, 1 offense detected

Is there any way to remove the space and submit this again? I'm not the pull request creator so I'm not sure how this can progress to the next step.

@deivid-rodriguez
Copy link
Member

The reason is not the space, but that nobody has been able to review it yet. I'll try to find some time.

@mingchang
Copy link

Cool, got it. I think this is a great addition to ActiveAdmin due to much cleaner code in customizing "show" pages. Would clear up some confusion I've seen around the net as well from devs who found this new syntax much more intuitive. Thanks for the quick response!

@javierjulio
Copy link
Member

@mirelon I will accept this if a test is added. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to change labels in show -> attributes_table Specify label for attributes_table row
4 participants