Skip to content

Display 'No records found.' if there are no results returned. #41

Merged
merged 22 commits into from Aug 17, 2012

3 participants

@barendt
barendt commented Aug 3, 2012

Would you be open to incorporating something like this?

If so, please let me know if you'd like me to make any changes to the implementation. Also, do you have any suggestions on specs you'd like to see?

@bogdan
Owner
bogdan commented Aug 3, 2012

I like it in general

But there is a localization problem.
Can we use any symbolic representation of 'No records found.' ? For example long dash or something else.

Please add one spec somewhere in here https://github.com/bogdan/datagrid/blob/master/spec/datagrid/helper_spec.rb

@barendt
barendt commented Aug 7, 2012

I changed this to use I18n.translate, is that a better solution?

Also, can you give me any advice on writing this spec? I'm having a hard time coming up with a good way to create a report within the context of helper_spec.rb that doesn't have any records in it.

@bogdan
Owner
bogdan commented Aug 10, 2012

I18n.translate is ok.

Can we try —— (——) as a default?
It's localization agnostic and probably would fit more projects out of the box.
We need to ensure that it looks nice in browser.

Take a look at http://gusiev.com/dorspec/#1 if you want to get started with advanced rspec features.
Test case:

context "when grid has no records" do
let(:grid) do
  test_report do 
    scope {Entry.where("1 != 1")}
  end
end

it "should show empty table" do
 datagrid_table = subject.datagrid_table(grid)

 datagrid_table.should match_css_pattern(...)
end
end
@barendt
barendt commented Aug 17, 2012

Thanks! I pushed a spec for this. I also changed this to use —— as the default. I think it looks nice, but let me know if you'd like me to try something else.

@bogdan bogdan merged commit f32adef into bogdan:master Aug 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.