diff --git a/app/views/rails_admin/main/index.html.haml b/app/views/rails_admin/main/index.html.haml
index b3d6bdd702..8018d69b85 100644
--- a/app/views/rails_admin/main/index.html.haml
+++ b/app/views/rails_admin/main/index.html.haml
@@ -90,7 +90,7 @@
%th.last.shrink
%tbody
- @objects.each do |object|
- %tr{class: "#{@abstract_model.param_key}_row"}
+ %tr{class: "#{@abstract_model.param_key}_row #{@model_config.list.with(object: object).row_css_class}"}
%td
= check_box_tag "bulk_ids[]", object.id, false
- if @other_left_link ||= other_left && index_path(params.except('set').merge(params[:set].to_i != 1 ? {set: (params[:set].to_i - 1)} : {}))
diff --git a/lib/rails_admin/config/sections/list.rb b/lib/rails_admin/config/sections/list.rb
index dbad27cd75..fd2a20a7a7 100644
--- a/lib/rails_admin/config/sections/list.rb
+++ b/lib/rails_admin/config/sections/list.rb
@@ -25,6 +25,10 @@ class List < RailsAdmin::Config::Sections::Base
register_instance_option :scopes do
[]
end
+
+ register_instance_option :row_css_class do
+ ''
+ end
end
end
end
diff --git a/spec/integration/basic/list/rails_admin_basic_list_spec.rb b/spec/integration/basic/list/rails_admin_basic_list_spec.rb
index ebaa7e6e31..ba617677d0 100644
--- a/spec/integration/basic/list/rails_admin_basic_list_spec.rb
+++ b/spec/integration/basic/list/rails_admin_basic_list_spec.rb
@@ -564,4 +564,27 @@
end
end
end
+
+ describe 'Row CSS class' do
+ before do
+ RailsAdmin.config do |config|
+ config.model Team do
+ list do
+ row_css_class { 'my_class' }
+ end
+ end
+ end
+ @teams = [
+ FactoryGirl.create(:team, color: 'red'),
+ FactoryGirl.create(:team, color: 'red'),
+ FactoryGirl.create(:team, color: 'white'),
+ FactoryGirl.create(:team, color: 'black'),
+ ]
+ end
+
+ it 'appends the CSS class to the model row class' do
+ visit index_path(model_name: 'team')
+ expect(page).to have_css('tr.team_row.my_class')
+ end
+ end
end