Plugins - Smart-Form 1.0
Add to favoritesThe last form plugin you may ever need
Generates form fields for a model - including it’s content columns, and all association reflections.
These form fields are encapsulated in an HTML definition list, and a style-sheet for table like layout is supplied.
| Author: | Michael Behan aka "Jabberwock" (jabberwock /AT tenebrous /DOT com) |
| Copyright: | Copyright© 2007 Jabbewock |
| License: | BSD |
| Request: | Please feel free to e-mail me with feedback! |
#
Generators:
You can generate a sample style-sheet with:
ruby ./script/generate SmartFormStyle
#
Note:
+smart_form_for+ generates only the +form+ fields and not the starting/ending +form+ tags.
#
Usage:
smart_form_for(symbol, options)
#
Examples:
<% form_for "/people", :method => :post do %>
<%= smart_form_for :person %>
<% end %>
#
Other Examples:
<%= smart_form_for :person, :exclude => 'created_at' %> <%= smart_form_for :person, :exclude => ['created_at', 'updated_at'], :class => 'my_list', :style => 'border:1px solid white;', :id => 'my_list' %>
#
Required
- symbol — A symbol of a model instance variable for which the form fields will be generated.
Options
- :object — Takes an instance variable (ie; used to load form defaults for editing)
- :order — Display order; an array of column or reflectin names.
- :habtm_select_values— A hash in which each key is a habtm reflection name and the value is the foreign column to use for the select/multiple option values. By default, the first column of type text or varchar is used.
- :exclude — A String, or an Array of column names (or associatin reflection(s)) to exclude from the form.
- :include — A String, or an Array of column names which would not otherwise be included in the model’s content_columns. For example, an ‘orders’ table might contain a ‘transaction_id’ column which refers to an Authorize.NET transaction ID, and not a foreign key to a ‘transactions’ table. Because this column ends with "_id", it will not be in the models content columns. Use this option to display form fields for these types of columns.
- :class — The class attribute for the DL element (defaults to "smart_form").
- :text_field — HTML options for text input fields.
- :number_text_field — HTML options for text input fields that deal with numbers (ie: decimal, float, integer)
- :text_area — HTML options for textarea elements
- :select — Options for select (default: :include_blank => true). Also contains a nested :html hash of HTML options to pass.
- :date_select — HTML options for date_select
- :datetime_select — HTML options for datetime_select
- :time_select — HTML options for time_select
- :mselect — HTML options for +select multiple="multiple"+ boxes
- :mselect_footnote — A footnote which appears below select/multiples (default: "(crtl+click to select multiple)")
- :left_width — The width of the left column in pixels. If specified, this setting will override the style-sheet
- :right_width — The width of the right column in pixels. If specified, this setting will override the style-sheet
Tags
actionview
associations
bitchin
easy
fds
fields
forms
habtm
jabberwock
reflections
scaffold
smart
useful

svn is not working, the site bleedingtrends.com is actually parked!
Repository still unavailable.
Can't get from Repository
Demo not working, I can't see how the form looks like.
They're based on the column or reflection names.
Where are the labels coming from?
By default, the display order is as it appears in the database (ie
DESCRIBE TABLEor\d table. I have added an :order option which takes an array of column/reflections for display order. Please svn up!How is order of items in the form determined?
As promised, here is a simple demo:
http://admin.beta.ddna.org/smartformdemo
This appears to be an issue with your postgres gem installation. SmartForm extends ActiveRecord and doesn't actually reference the database adapter directly. Have you tried the ruby-pr gem?
Hey looks like it does not work with postgres database. generates this error: "126: The specified module could not be found. - c:/ruby/lib/ruby/gems/1.8/gems/ruby-postgres-0.7.1.2006.04.06-mswin32/./postgres.so" despite having the latest build for that gem. Otherwise it worked fine with mysql database.
I second the request for a live demo or screenshots. Would be most helpful.
I will have this up soon :) Thanks!
Please post a link with examples of how the smart forms look.