Skip to content

bsiggelkow/flow_grid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlowGrid

Description

Flow grid is a simple Rails plugin for creating grid-like views of collections. The data can flow from left-to-right (row) or top-to-bottom (column). The column orientation often has better usability than row orientation.

Install

master (~ rails-2.3)

script/plugin install git://github.com/bsiggelkow/flow_grid.git

Rails 2.3

script/plugin install git://github.com/bsiggelkow/flow_grid.git -r rails-2.3

Rails 3.0

rails plugin install git://github.com/bsiggelkow/flow_grid.git -r rails-3.0

Examples

Basic usage:

<%= flow_grid collection,   # collection (must respond to [])
                :partial => 'my_partial', # partial that renders the collection item
                :columns => 3,            # number of columns
                :flow    => :vertial,     # orientation (horizontal | vertical)
                :fill    => '&nbsp;',     # fill empty cells with this value
                :class   => 'flow_grid'   # this and all succeeding options passed as html attributes to table tag
%>

Without a partial:

<%= flow_grid collection, :columns => 3 %>

With a block (with each result of the block passed to the partial):

<%= flow_grid( collection, :partial => '_some_partial', :columns => 4 ) { |obj| obj.to_s.capitalize } %>

FlowGrid works its magic the good old-fashioned way – TABLES! Seriously, some HTML is just a bit easier to render tables and this is one of them. I have considered creating a “table-less” option (using a combination styled divs and unordered lists); but generally I find the solution more cumbersome than the table-based alternative.

Questions and/or Comments

github.com/bsiggelkow/flow_grid

Copyright © 2010 Bill Siggelkow, released under the MIT license

About

A simple Rails view helper for rendering a grid in a horizontal or vertical orientation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages