Skip to content

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

Closed
ghost wants to merge 1 commit into
masterfrom
unknown repository
Closed

Add instance option to append a CSS class for rows#2606
ghost wants to merge 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Apr 6, 2016

Copy link
Copy Markdown

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

As Rails Admin uses Bootstrap, I wanted to use the tables
contextual classes in my lists.
This is an approach to add classes per list declared in
RailsAdmin::Config.
@mshibuya

Copy link
Copy Markdown
Member

Test needed!

@ghost

ghost commented Aug 13, 2016

Copy link
Copy Markdown
Author

indeed, I'll add them soon, @mshibuya; however, do you find it helpful?
I really don't know if there's a better/cleaner way to implement this.

@mshibuya

Copy link
Copy Markdown
Member

I think this is okay, it's simple and useful 😃

@ghost

ghost commented Mar 25, 2017

Copy link
Copy Markdown
Author

@mshibuya, I will close this PR in favour of #2860.
It will be great if you can give me another review (after almost 1 year, hehe)

@ghost ghost closed this Mar 25, 2017
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant