Home > compact_table

compact_table

Compact_table is a project mainly written in RUBY and JAVASCRIPT, based on the MIT license.

Table display plugin that allows you to hide specific HTML until the user requests it

CompactTable

CompactTable was created to solve the problem of displaying the index page for a complicated object with many fields. Often, these fields run over the width of the page. CompactTable allows the user to specify two classes of html code. The first, to be shown by default, and the second which only displays when the user clicks a link.

When you install this plugin, make sure to copy the css and js files to the public/stylesheets and public/javascripts folders.

Example

Lets say we have a model, People, and this is app/views/people/index.html.erb.

<% compacttable({:collection => @people, :identifier => 'people', :lambda_toggle_link => lambda { |person| -%> <%= h person.name %> <% }, :lambda_displayed => lambda { |person| -%> <%= h person.age %> <%= h person.alive? %> <% } , :lambda_hidden => lambda { |exercise| -%>

About me

<%= person.about %> <% }}) -%>

The first lambda (lambda_toggle_link) defines what the text for the link that opens and closes the table will be.

The second lambda (lambda_displayed) shows the displayed information. The CSS classes for left and right just define float status for you so that some text is aligned on the left and some on the right.

The third lambda (lambda_hidden) is the data that will be hidden until the user clicks lambda_toggle_link.

Copyright (c) 2008 Nick Gauthier ([email protected]), released under the MIT license

Previous:quick_menu