Skip to content

dmcnally/designer_friendly

Repository files navigation

DesignerFriendly
================

Designer friendly is aimed at making it easier for designers to style the
various inputs types used within rails forms.  By providing different
custom form builders which render out partials it is easier for a designer
to provide a number of form styles that may be used within an application.

This plugin does not have any unit tests at this point and has only been
developed against edge rails.

Just as an ass covering excerise I have yet to test this properly with various
different input types, especially checkboxes, dropdowns and radio buttons.
Use, experiment, modify at your own risk.  It is more a proof of concept that
needs taking further

UPDATE 2009-02-17: check box inputs work fine.  Have added in an example
checkbox template - rerun generator to include in application.

Usage
=====

To generate a custom form builder use the following command from the application
root

./script/generate designer_friendly <form_builder_name>

Example
=======

./script/generate designer_friendly pretty

Will generate the custom form builder PrettyFormBuilder.  The PrettyFormBuilder
class will be created in the models folder.  The partials for the form builder
will be created in the "forms/pretty_form_builder".  In the first instance only
a general, text_field and text_area partials will be created.  You can create
others and try them out by creating a partial that follows the same naming
convention as the input type.

To use the builder specify the builder when using form_for :-

form_for @object, :builder => PrettyFormBuilder do |f|

end

the generate will create a forms/pretty folder in your views folder and copy
four example partials.

When using the form helper commands there is no need to render the label and
the input separately.  The following will render the input and a label for the
title field:

f.text_field :title

There is also an option to override the label with custom text as follows:

f.text_field :title, :label => "Enter the title"


Thanks
======

I'd like to thank Mike Mangino (http://www.elevatedrails.com) for the most
excellent recipe published in "Advanced Rails Recipes" which gave me some
direction in writing this plugin.  I'd also like to extend my gratitude to
certain designers for their constant bitching about Rails spitting out ugly HTML
(In fairness they said the same about other frameworks too) who gave me the
inspiration to write this if only to shut them up.

Copyright (c) 2009 David McNally, released under the MIT license

About

Designer friendly forms for rails

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages