Skip to content

Commit

Permalink
Follow-up for #3365
Browse files Browse the repository at this point in the history
- Add a spec
- Use I18n for the message
- Do not align to center for visual consistency
  • Loading branch information
mshibuya committed Oct 4, 2021
1 parent 537fe41 commit a5fe6f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/views/rails_admin/main/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
%ul.inline.list-inline= menu_for :member, @abstract_model, object, true
- if @objects.empty?
%tr{class: "empty_row"}
%td{:colspan => table_table_header_count, :style=>"text-align: center;"} No Records found
%td{colspan: table_table_header_count}
= I18n.t('admin.actions.index.no_records')
- if @model_config.list.limited_pagination
.row
.col-md-6= paginate(@objects, theme: 'ra-twitter-bootstrap/without_count', total_pages: Float::INFINITY, remote: true)
Expand Down
1 change: 1 addition & 0 deletions config/locales/rails_admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ en:
title: "List of %{model_label_plural}"
menu: "List"
breadcrumb: "%{model_label_plural}"
no_records: "No records found"
show:
title: "Details for %{model_label} '%{object_label}'"
menu: "Show"
Expand Down
10 changes: 10 additions & 0 deletions spec/integration/actions/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,16 @@
end
end

context 'when no record exists' do
before do
visit index_path(model_name: 'player')
end

it "shows \"No records found\" message" do
is_expected.to have_content('No records found')
end
end

context 'without pagination' do
before do
@players = FactoryBot.create_list(:player, 2)
Expand Down

0 comments on commit a5fe6f8

Please sign in to comment.