Plugins - CssFormBuilder
Add to favoritesFeatures:
- Each field label is automatically added at the top of the input control.
- Each input control appears at the right of the last control (unless there is not enough space).
- To force a control in a new row, use before adding it.
- Use html option {:class=>’half-size’ } or {:class=>’double-size’ } for changing control size.
- Use class ‘half-size’, ‘normal-size’ or ‘double-size’ to force select tags size.
- Use <% fieldset tag ‘legend’ %> [block] <% end %> to produce fieldset tags.
- By default, a fieldset expands to the right form margin; use html option {:class=>’continue’} to compact the fieldset. Next fieldset will be added to the right.
- Support translation of labels and legends using _() function (by first calling CssBuilder?.translate_as_gettext) or String.t method (by first calling CssBuilder?.translate_as_globalize)
- Support both standard html form (css_form_for) and remote form (remote_css_form_for)
- Also contains a show builder (css_show_for) that looks like new/edit forms and uses the same template file (_form.rhtml). Fields values are displayed as html text, without form and input objects.
Sample usage:
File app/views/customers/_form.rhtml:
<%= error_messages_for 'customer' %>
<% fieldset_tag 'General data' do %>
<%= @f.text_field :code, :class=>'half-size' %>
<%= @f.text_field :name, :class=>'double-size' %>
<%= @f.select(:bank_id, Bank.to_select, {:include_blank => true}, {:class=>'normal-size'} ) %>
<%= @f.check_box :option1 %>
<%= @f.hidden_field :field1 %>
<% end %>
File app/views/customers/new.rhtml:
<% css_form_for :customer, @customer, :url => { :action => "create" } do |@f| %>
<%= render :partial => 'form' %>
<%= submit_tag 'Create' %>
<% end %>
File app/views/customers/edit.rhtml:
<% css_form_for :customer, @customer, :url => { :action => 'update', :id => @customer } do |@f| %>
<%= render :partial=> 'form' %>
<%= submit_tag 'Edit' %>
<% end %>
File app/views/customers/show.rhtml:
<% css_show_for :customer, @customer, do |@f| %>
<%= render :partial=> 'form' %>
<% end %>
http://cssformbuilder.rubyforge.org/wiki/wiki.pl
svn://rubyforge.org/var/svn/cssformbuilder/trunk
Rails' (MIT)
View Extensions

You need a external translation system, like globalize, gettext, rails localization plugin or simply a custom function _(), like:
def (stringto_translate) "translated string" end
If you call CssFormBuilder.translateas_globalize, then labels are rendered as "labelstring".t, while, calling CssFormBuilder.translateas_gettext , results in _("labelstring")
GAL (http://sf.net/projects/gal) is a rails app using CssFormBuilder with translation , provided by a patched localization plugin
(sorry for delay in reply, but I'm not monitoring comments)
Neat plugin! It reduced my form-development effort substantially. Only thing - I couldnt quite figure out how to use the translation of labels feature. Could you please provide an example. Thanks in advance
Use option :label=>'your custom label'. I prefer not to automatically add newline after controls, so it's possible to have more control in the same row. You can change your css (or your local code) in order to obtain this. About better css... it's out of my possibilities! Css designers, help me!
Hi,
Can I customise the labels produced?
Fairly good plugin. Needs a bit more:
Xin