Gem add the ability quickly create table render_table_for
.
Using in your helpers or views.
== Installation
1 Add this line to your application's Gemfile:
gem 'easytable'
2 And then execute:
$ bundle
== When to use it
If you too lazy to work with content tags or you hate a lot of html in your views, you can use just one line to generate simple table.
== Usage Examples
render_table_for(columns: [['Bob', '[email protected]'], ['Ben', '[email protected]']])
or
render_table_for(header: ['First name', 'Last name'], columns: @columns)
or
render_table_for(header: [:id, :email], columns: User.last(10))
or
render_table_for(User.last(10))
Also you can specify table class name and id, using class
and id
:
render_table_for(header: [], columns: [], class: 'custom-class', id: 'table_id')
default class name is easy-table
== Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request