Skip to content

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

Merged
mshibuya merged 1 commit into
masterfrom
unknown repository
Mar 26, 2017
Merged

Add instance option to append a CSS class for rows#2860
mshibuya merged 1 commit into
masterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@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
Copy Markdown
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