= g_already_grid http://github.com/midas/g_already_grid/tree/master == DESCRIPTION: A Guilded (http://github.com/midas/guilded/tree/master) Rails component that generates a rich grid control from an ActiveRecord collection. == FEATURES: * Easily generate a rich grid from an ActiveRecord collection * Can integrate with mislav-will_paginate to provide paging controls * Can generate sorting links in headers * Can do a check box column for multi-selecting * Automatically renders a check all and adds check all behavior if check box column option == INSTALL: sudo gem install midas-g_already_grid In Rails environemnt.rb file: config.gem 'midas-g_already_grid', :version => '1.0.2', :lib => 'g_already_grid', :source => 'http://gems.github.com' Generate: script/generate already_grid_assets_generator == USAGE: Simplest case: <%= g_already_grid @items, :id => "items-grid", :cols => [:name, :is_active] %> Add sorting (by name column only): <%= g_already_grid @items, :id => "items-grid", :cols => [:name, :is_active], :sort => [:name] %> Add scoping for nested models (deeply nested): <%= g_already_grid @items, :id => "items-grid", :cols => [:name, :is_active], :sort => [:name], :scoped_by => @account %> Add shallow option to use shallow nesting: <%= g_already_grid @items, :id => "items-grid", :cols => [:name, :is_active], :sort => [:name], :scoped_by => @account, :shallow => true %> Add namespace option for namespacing: <%= g_already_grid @items, :id => "items-grid", :cols => [:name, :is_active], :sort => [:name], :namespace => :admin %> Add use polymorphic path option for STI'ed models: <%= g_already_grid @items, :id => "items-grid", :cols => [:name, :is_active], :sort => [:name], :namespace => :admin, :use_polymorphic_path => true %> == OPTIONS: id:: The HTML id attribute. cols:: (required) An array of column names to include in the table. Each position of the array can be a symbol, string, or hash with 1 entry. The hash entry is the database field name as a key and the name to use in the gird as the value. Each key and value in the hash can be a symbol or string. skin:: The name of the skin to use for this Guilded element. Defaults to default => which is default.css. exclude_css:: A boolean indicating if Guilded should create a stylesheet inlcude tag for this element. Defaults to false. empty_msg:: a message to display when the ar_col is empty or nil. Defaults to 'No matching records'. actions:: Action links to include in the action column of grid. A boolean or Array of symbols. When boolean, if true, add show, edit and delete actions. When boolean, if false, hide actions column. When Array of symbols, add only actions present in array. paginate:: A boolean indicating whether to output pagination controls. Defaults to true. Utilizes will_paginate plugin features. polymorphic_type:: The type of this polymorphic record. Should be a string representing the class name. polymorphic_as:: The as used for the polymorphic type. Can be a symbol or string. use_polymorphic_path:: When true, uses hte polymorphic path helper to determine the AR objects path from it's type (STI), otherwise, does not. Defaults to false. namespace:: A string or symbol that is the namespace this collection is under. scoped_by:: The active record object that the objects in the ar_col is scoped by. shallow:: True if this collection is nested shallow, otherwise, false. clickable:: Set to false in order to avoid rows linking to show action. Defaults to true. adaptable_url:: True in order to make the index url automagically adapt to :get collection routes, otherwise false. == REQUIREMENTS: * Rails >= 2.2.0 * Guilded >= 1.0.0 (http://github.com/midas/guilded/tree/master) * will_paginate == LICENSE: (The MIT License) Copyright (c) 2009 C. Jason Harrelson (midas) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.