Sha256: b94ba08a1d2d797ca29751296b860a3772e6e9672193b9c725851e3abad7faf4

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

SimpleTableFor
==============

A simple helper to generate tables in Rails applications.

In your Gemfile:

```ruby
gem 'simple_table_for'
```

Parameters:

```ruby
table_for(collection, headers, options, &block)
```

Usage:

```erb
<%= table_for @posts, %w[Title Text Date Comments\ count -] do |post| %>
  <%= field post.title %>
  <%= field post.text %>
  <%= field post.date %>
  <%= field post.comments.count %>
  <%= field link_to('View', post) %>
<% end %>
```

You can optionally add an id or classes to tables and fields:

```erb
<%= table_for @posts, %w[Title -], id: 'posts-table', class: 'table' do |post| %>
  <%= field post.title, class: 'post-title' %>
  <%= field link_to('View', post), class: 'view' %>
<% end %>
```

You can also set default id and class for tables:

```ruby
# application.rb
class Application < Rails:Application
  config.simple_table_for.defaults = {
    class: 'table table-condensed table-striped table-bordered'
  }
end
```

This project uses MIT-LICENSE.

## Contributing

1. Fork it ( https://github.com/andreynering/simple_table_for/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_table_for-0.2.0 README.md