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

Add instance option to append a CSS class for rows #2860

Merged
merged 1 commit into from Mar 26, 2017
Merged

Add instance option to append a CSS class for rows #2860

merged 1 commit into from Mar 26, 2017

Conversation

ghost
Copy link

@ghost ghost commented Mar 25, 2017

Follow up of PR #2606 , with tests

As Rails Admin uses Bootstrap, I wanted to use the table's contextual classes in my lists.
This is an approach to implement that using a method declared in RailsAdmin::Config,
it has access to the object being rendered into the row.

Usage

RailsAdmin.config do |config|
config.model Event do
  list do
    row_css_class do
      bindings[:object].mode == 'panic' ? 'danger' : 'success'
    end
end

@mshibuya mshibuya merged commit a58002b into railsadminteam:master Mar 26, 2017
@mshibuya
Copy link
Member

Thanks 👍

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.

1 participant