Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 477 lines (351 sloc) 19.831 kb
420b4ce @justinfrench sick of updating the README with every version bump :)
authored
1 h1. Formtastic
dcf8beb Initial Commit
Justin French authored
2
3 Formtastic is a Rails FormBuilder DSL (with some other goodies) to make it far easier to create beautiful, semantically rich, syntactically awesome, readily stylable and wonderfully accessible HTML forms in your Rails applications.
4
09d957d textilized the README so that it looks pretty pretty on GitHub
Justin French authored
5 h2. The Story
dcf8beb Initial Commit
Justin French authored
6
2d4a72b @justinfrench big update to the README
authored
7 One day, I finally had enough, so I opened up my text editor, and wrote a DSL for how I'd like to author forms:
dcf8beb Initial Commit
Justin French authored
8
09d957d textilized the README so that it looks pretty pretty on GitHub
Justin French authored
9 <pre>
7e3874a @justinfrench trying to fix README formatting of <'s at the start of lines
authored
10 <% semantic_form_for @article do |form| %>
353618e @markmansour Extending Formtastic can be done by overriding the semantic_form_buil…
markmansour authored
11
0b370ba @justinfrench Renamed input_field_set() to just inputs() and added a shorthand vers…
authored
12 <% form.inputs :name => "Basic" do %>
353618e @markmansour Extending Formtastic can be done by overriding the semantic_form_buil…
markmansour authored
13 <%= form.input :title %>
14 <%= form.input :body %>
1db292f @sprsquish update README to reflect association attribute changes
sprsquish authored
15 <%= form.input :section %>
16 <%= form.input :publication_state, :as => :radio %>
9997ce6 @josevalim Added more information about inputs :for in README.
josevalim authored
17 <%= form.input :category %>
353618e @markmansour Extending Formtastic can be done by overriding the semantic_form_buil…
markmansour authored
18 <%= form.input :allow_comments, :label => "Allow commenting on this article" %>
19 <% end %>
20
0b370ba @justinfrench Renamed input_field_set() to just inputs() and added a shorthand vers…
authored
21 <% form.inputs :name => "Advanced" do %>
353618e @markmansour Extending Formtastic can be done by overriding the semantic_form_buil…
markmansour authored
22 <%= form.input :keywords, :required => false, :hint => "Example: ruby, rails, forms" %>
7e3874a @justinfrench trying to fix README formatting of <'s at the start of lines
authored
23 <%= form.input :extract, :required => false %>
24 <%= form.input :description, :required => false %>
353618e @markmansour Extending Formtastic can be done by overriding the semantic_form_buil…
markmansour authored
25 <%= form.input :url_title, :required => false %>
7e3874a @justinfrench trying to fix README formatting of <'s at the start of lines
authored
26 <% end %>
27
05ae54d @josevalim Fixed nested attributes example in README
josevalim authored
28 <% form.inputs :name => "Author", :for => :author do |author_form| %>
29 <%= author_form.input :first_name %>
30 <%= author_form.input :last_name %>
9997ce6 @josevalim Added more information about inputs :for in README.
josevalim authored
31 <% end %>
32
353618e @markmansour Extending Formtastic can be done by overriding the semantic_form_buil…
markmansour authored
33 <% form.buttons do %>
34 <%= form.commit_button %>
7e3874a @justinfrench trying to fix README formatting of <'s at the start of lines
authored
35 <% end %>
09d957d textilized the README so that it looks pretty pretty on GitHub
Justin French authored
36
dcf8beb Initial Commit
Justin French authored
37 <% end %>
09d957d textilized the README so that it looks pretty pretty on GitHub
Justin French authored
38 </pre>
39
6734cfd @justinfrench sme typos and cleanups in the readme
authored
40 I also wrote the accompanying HTML output I expected, favoring something very similar to the fieldsets, lists and other semantic elements Aaron Gustafson presented in "Learning to Love Forms":http://www.slideshare.net/AaronGustafson/learning-to-love-forms-web-directions-south-07, hacking together enough Ruby to prove it could be done.
dcf8beb Initial Commit
Justin French authored
41
42
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
43 h2. It's better than _SomeOtherFormBuilder_ because...
44
6688887 @grimen More README-polishing.
grimen authored
45 * it can handle @belongs_to@ associations (like Post belongs_to :author), rendering a select or set of radio inputs with choices from the parent model.
46 * it can handle @has_many@ and @has_and_belongs_to_many@ associations (like: Post has_many :tags), rendering a multi-select with choices from the child models.
47 * it's Rails 2.3-ready (including nested forms).
f02b136 @justinfrench rearranged and beefed up the 'it's better than...' README section
authored
48 * it has internationalization (I18n)!
6688887 @grimen More README-polishing.
grimen authored
49 * it's _really_ quick to get started with a basic form in place (4 lines), then go back to add in more detail if you need it.
50 * there's heaps of elements, id and class attributes for you to hook in your CSS and JS.
51 * it handles real world stuff like inline hints, inline error messages & help text.
52 * it doesn't hijack or change any of the standard Rails form inputs, so you can still use them as expected (even mix and match).
53 * it's got absolutely awesome spec coverage.
54 * there's a bunch of people using and working on it (it's not just one developer building half a solution).
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
55
56
15e0bd9 updated the README a little to match last night's slides
Justin French authored
57 h2. Why?
58
6688887 @grimen More README-polishing.
grimen authored
59 * web apps = lots of forms.
60 * forms are so friggin' boring to code.
61 * semantically rich & accessible forms really are possible.
62 * the "V" is way behind the "M" and "C" in Rails' MVC – it's the ugly sibling.
63 * best practices and common patterns have to start somewhere.
64 * i need a challenge.
dcf8beb Initial Commit
Justin French authored
65
66
15e0bd9 updated the README a little to match last night's slides
Justin French authored
67 h2. Opinions
68
6688887 @grimen More README-polishing.
grimen authored
69 * it should be easier to do things the right way than the wrong way.
70 * sometimes _more mark-up_ is better.
71 * elements and attribute hooks are _gold_ for stylesheet authors.
72 * make the common things we do easy, yet still ensure uncommon things are still possible.
15e0bd9 updated the README a little to match last night's slides
Justin French authored
73
dcf8beb Initial Commit
Justin French authored
74
3dd6455 @justinfrench Link to RDoc URL in README
authored
75 h2. Documentation
76
77 RDoc documentation _should_ be automatically generated after each commit and made available on the "rdoc.info website":http://rdoc.info/projects/justinfrench/formtastic.
78
79
c89e985 @justinfrench updating README with gem/plugin installation instructions
authored
80 h2. Installation
81
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
82 The gem is hosted on gemcutter, so *if you haven't already*, add it as a gem source:
c89e985 @justinfrench updating README with gem/plugin installation instructions
authored
83
84 <pre>
2bf5b23 @justinfrench updated README to reflect gemcutter gem source
authored
85 sudo gem sources -a http://gemcutter.org/
c89e985 @justinfrench updating README with gem/plugin installation instructions
authored
86 </pre>
87
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
88 Then install the Formtastic gem:
c89e985 @justinfrench updating README with gem/plugin installation instructions
authored
89
90 <pre>
2bf5b23 @justinfrench updated README to reflect gemcutter gem source
authored
91 sudo gem install formtastic
c89e985 @justinfrench updating README with gem/plugin installation instructions
authored
92 </pre>
93
2bf5b23 @justinfrench updated README to reflect gemcutter gem source
authored
94 Optionally, run @./script/generate formtastic@ to copy the following files into your app:
fc29eaa @justinfrench Combined the "formtastic_config" and "formtastic_stylesheets" generat…
authored
95
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
96 * @config/initializers/formtastic.rb@ - a commented out Formtastic config initializer
97 * @public/stylesheets/formtastic.css@
98 * @public/stylesheets/formtastic_changes.css@
c89e985 @justinfrench updating README with gem/plugin installation instructions
authored
99
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
100 A proof-of-concept stylesheet is provided which you can include in your layout. Customization is best achieved by overriding these styles in an additional stylesheet so that the Formtastic styles can be updated without clobbering your changes. If you want to use these stylesheets, add both to your layout:
c89e985 @justinfrench updating README with gem/plugin installation instructions
authored
101
5c1ce48 @justinfrench moved the stylesheets stuff up with installation
authored
102 <pre>
103 <%= stylesheet_link_tag "formtastic" %>
104 <%= stylesheet_link_tag "formtastic_changes" %>
105 </pre>
2526d2c @justinfrench Going back to generators instead of Rake tasks for copying stylesheet…
authored
106
c89e985 @justinfrench updating README with gem/plugin installation instructions
authored
107
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
108 h2. Usage
109
110 Forms are really boring to code... you want to get onto the good stuff as fast as possible.
111
6688887 @grimen More README-polishing.
grimen authored
112 This renders a set of inputs (one for _most_ columns in the database table, and one for each ActiveRecord @belongs_to@-association), followed by a submit button:
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
113
114 <pre>
115 <% semantic_form_for @user do |form| %>
116 <%= form.inputs %>
117 <%= form.buttons %>
118 <% end %>
119 </pre>
120
121 If you want to specify the order of the fields, skip some of the fields or even add in fields that Formtastic couldn't detect, you can pass in a list of field names to @inputs@ and list of button names to @buttons@:
122
123 <pre>
124 <% semantic_form_for @user do |form| %>
125 <%= form.inputs :title, :body, :section, :categories, :created_at %>
126 <%= form.buttons :commit %>
127 <% end %>
128 </pre>
129
6688887 @grimen More README-polishing.
grimen authored
130 If you want control over the input type Formtastic uses for each field, you can expand the @inputs@ and @buttons@ blocks. This specifies the @:section@ input should be a set of radio buttons (rather than the default select box), and that the @:created_at@ field should be a string (rather than the default datetime selects):
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
131
132 <pre>
133 <% semantic_form_for @post do |form| %>
134 <% form.inputs do %>
135 <%= form.input :title %>
136 <%= form.input :body %>
137 <%= form.input :section, :as => :radio %>
138 <%= form.input :categories %>
139 <%= form.input :created_at, :as => :string %>
140 <% end %>
141 <% form.buttons do %>
142 <%= form.commit_button %>
143 <% end %>
144 <% end %>
145 </pre>
146
a45853c @justinfrench small README typo
authored
147 If you want to customize the label text, or render some hint text below the field, specify which fields are required/optional, or break the form into two fieldsets, the DSL is pretty comprehensive:
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
148
149 <pre>
150 <% semantic_form_for @post do |form| %>
151 <% form.inputs :name => "Basic", :id => "basic" do %>
152 <%= form.input :title %>
153 <%= form.input :body %>
154 <% end %>
155 <% form.inputs :name => "Advanced Options", :id => "advanced" do %>
156 <%= form.input :slug, :label => "URL Title", :hint => "Created automatically if left blank", :required => false %>
157 <%= form.input :section, :as => :radio %>
158 <%= form.input :user, :label => "Author", :label_method => :full_name, %>
159 <%= form.input :categories, :required => false %>
160 <%= form.input :created_at, :as => :string, :label => "Publication Date", :required => false %>
161 <% end %>
162 <% form.buttons do %>
163 <%= form.commit_button %>
164 <% end %>
165 <% end %>
166 </pre>
167
9997ce6 @josevalim Added more information about inputs :for in README.
josevalim authored
168 Nested forms (Rails 2.3) are also supported. You can do it in the Rails way:
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
169
170 <pre>
05ae54d @josevalim Fixed nested attributes example in README
josevalim authored
171 <% semantic_form_for @post do |form| %>
172 <%= form.inputs :title, :body, :created_at %>
41a6754 @josevalim Another README fix.
josevalim authored
173 <% form.semantic_fields_for :author do |author| %>
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
174 <%= author.inputs :first_name, :last_name, :name => "Author" %>
41a6754 @josevalim Another README fix.
josevalim authored
175 <% end %>
05ae54d @josevalim Fixed nested attributes example in README
josevalim authored
176 <%= form.buttons %>
9997ce6 @josevalim Added more information about inputs :for in README.
josevalim authored
177 <% end %>
178 </pre>
179
6fd1bd2 @justinfrench improving the documentation in README
authored
180 Or the Formtastic way with the @:for@ option:
9997ce6 @josevalim Added more information about inputs :for in README.
josevalim authored
181
182 <pre>
05ae54d @josevalim Fixed nested attributes example in README
josevalim authored
183 <% semantic_form_for @post do |form| %>
184 <%= form.inputs :title, :body, :created_at %>
185 <%= form.inputs :first_name, :last_name, :for => :author, :name => "Author" %>
186 <%= form.buttons %>
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
187 <% end %>
188 </pre>
189
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
190 When working in has many association, you can even supply @"%i"@ in your fieldset name that it will be properly interpolated with the child index. For example:
d5e3b0a @josevalim Added nested child nindex support.
josevalim authored
191
192 <pre>
193 <% semantic_form_for @post do |form| %>
194 <%= form.inputs %>
195 <%= form.inputs :name => 'Category #%i', :for => :categories %>
196 <%= form.buttons %>
197 <% end %>
198 </pre>
199
6fd1bd2 @justinfrench improving the documentation in README
authored
200
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
201 Customize HTML attributes for any input using the @:input_html@ option. Typically his is used to disable the input, change the size of a text field, change the rows in a textarea, or even to add a special class to an input to attach special behavior like "autogrow":http://plugins.jquery.com/project/autogrow textareas:
6fd1bd2 @justinfrench improving the documentation in README
authored
202
203 <pre>
204 <% semantic_form_for @post do |form| %>
205 <%= form.input :title, :input_html => { :size => 60 } %>
206 <%= form.input :body, :input_html => { :class => 'autogrow' } %>
207 <%= form.input :created_at, :input_html => { :disabled => true } %>
208 <%= form.buttons %>
209 <% end %>
210 </pre>
211
212 The same can be done for buttons with the @:button_html@ option:
213
214 <pre>
215 <% semantic_form_for @post do |form| %>
216 ...
217 <% form.buttons do %>
218 <%= form.commit_button :button_html => { :class => "primary" } %>
219 <% end %>
220 <% end %>
221 </pre>
222
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
223 Customize the HTML attributes for the @<li>@ wrapper around every input with the @:wrapper_html@ option hash. There's one special key in the hash (@:class@), which will actually _append_ your string of classes to the existing classes provided by Formtastic (like @"required string error"@)
224
6fd1bd2 @justinfrench improving the documentation in README
authored
225 <pre>
226 <% semantic_form_for @post do |form| %>
227 <%= form.input :title, :wrapper_html => { :class => "important" } %>
228 <%= form.input :body %>
229 <%= form.input :description, :wrapper_html => { :style => "display:none;" } %>
230 ...
231 <% end %>
232 </pre>
233
234
5a39443 @justinfrench bulking up the documentation and readme with the different inputs ava…
authored
235 h2. The Available Inputs
236
8577c18 @grimen More README-readability polishing.
grimen authored
237 * @:select@ - a select menu. Default for ActiveRecord associations: @belongs_to@, @has_many@, and @has_and_belongs_to_many@.
238 * @:check_boxes@ - a set of check_box inputs. Alternative to @:select@ for ActiveRecord-associations: @has_many@, and @has_and_belongs_to_many@.
239 * @:radio@ - a set of radio inputs. Alternative to @:select@ for ActiveRecord-associations: @belongs_to@.
240 * @:time_zone@ - a select input. Default for column types: @:string@ with name matching @"time_zone"@.
241 * @:password@ - a password input. Default for column types: @:string@ with name matching @"password"@.
242 * @:text@ - a textarea. Default for column types: @:text@.
243 * @:date@ - a date select. Default for column types: @:date@.
244 * @:datetime@ - a date and time select. Default for column types: @:datetime@ and @:timestamp@.
245 * @:time@ - a time select. Default for column types: @:time@.
246 * @:boolean@ - a checkbox. Default for column types: @:boolean@.
247 * @:string@ - a text field. Default for column types: @:string@.
248 * @:numeric@ - a text field (just like string). Default for column types: @:integer@, @:float@, and @:decimal@.
249 * @:file@ - a file field. Default for file-attachment attributes matching: "paperclip":http://github.com/thoughtbot/paperclip or "attachment_fu":http://github.com/technoweenie/attachment_fu.
250 * @:country@ - a select menu of country names. Default for column types: :string with name @"country"@ - requires a *country_select* plugin to be installed.
6688887 @grimen More README-polishing.
grimen authored
251 * @:hidden@ - a hidden field. Creates a hidden field (added for compatibility).
252
253 The documentation is pretty good for each of these (what it does, what the output is, what the options are, etc.) so go check it out.
5a39443 @justinfrench bulking up the documentation and readme with the different inputs ava…
authored
254
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
255 h2. Internationalization (I18n)
256
6688887 @grimen More README-polishing.
grimen authored
257 Formtastic got some neat I18n-features. ActiveRecord object names and attributes are, by default, taken from calling @@object.human_name@ and @@object.human_attribute_name(attr)@ respectively. There are a few words specific to Formtastic that can be translated. See @lib/locale/en.yml@ for more information.
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
258
71ef99f @justinfrench nuked the configuration copy/paste from the README, linked to the gen…
authored
259
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
260 h3. Label/Hint-localization
261
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
262 Formtastic supports localized *labels*, *hints*, *titles/legends*, *actions* using the I18n API for more advanced usage. Your forms can now be DRYer and more flexible than ever, and still fully localized. This is how:
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
263
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
264 Basic localization (labels only, with ActiveRecord):
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
265
266 <pre>
267 <% semantic_form_for @post do |form| %>
268 <%= form.input :title %> # => :label => I18n.t('activerecord.attributes.user.title') or 'Title'
269 <%= form.input :body %> # => :label => I18n.t('activerecord.attributes.user.body') or 'Body'
270 <%= form.input :section %> # => :label => I18n.t('activerecord.attributes.user.section') or 'Section'
271 <% end %>
272 </pre>
273
274 *Note:* This is perfectly fine if you just want your labels to be translated using *ActiveRecord I18n attribute translations*, and you don't use input hints. But what if you do? And what if you don't want same labels in all forms?
275
6688887 @grimen More README-polishing.
grimen authored
276 Enhanced localization (labels + hints + titles/legends + actions, with Formtastic):
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
277
278 1. Enable I18n lookups by default (@config/initializers/formtastic.rb@):
279
280 <pre>
281 Formtastic::SemanticFormBuilder.i18n_lookups_by_default = true
282 </pre>
283
284 2. Add some cool label-translations/variants (@config/locale/en.yml@):
285
286 <pre>
287 en:
288 formtastic:
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
289 titles:
290 post_details: "Post details"
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
291 labels:
292 post:
293 title: "Choose a title..."
294 body: "Write something..."
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
295 edit:
296 title: "Edit title"
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
297 hints:
298 post:
299 title: "Choose a good title for you post."
300 body: "Write something inspiring here."
4aca8cd @grimen New I18n-features:
grimen authored
301 actions:
302 create: "Create my {{model}}"
303 update: "Save changes"
304 dummie: "Launch!"
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
305 </pre>
306
307 *Note:* We are using English here still, but you get the point.
308
309 3. ...and now you'll get:
310
311 <pre>
4aca8cd @grimen New I18n-features:
grimen authored
312 <% semantic_form_for Post.new do |form| %>
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
313 <% inputs do %>
314 <%= form.input :title %> # => :label => "Choose a title...", :hint => "Choose a good title for you post."
315 <%= form.input :body %> # => :label => "Write something...", :hint => "Write something inspiring here."
316 <%= form.input :section %> # => :label => I18n.t('activerecord.attributes.user.section') or 'Section'
317 <% end %>
4aca8cd @grimen New I18n-features:
grimen authored
318 <% buttons do %>
319 <%= form.commit_button %> # => "Create my {{model}}"
320 <% end %>
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
321 <% end %>
322 </pre>
323
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
324 4. Localized titles (a.k.a. legends):
325
326 _Note: Slightly different because Formtastic can't guess how you group fields in a form._
327
328 <pre>
329 <% semantic_form_for @post do |form| %>
330 <% inputs :title => :post_details do %> # => :title => "Post details"
331 # ...
332 <% end %>
333 # ...
334 <% end %>
335 </pre>
336
337 5. Override I18n settings:
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
338
339 <pre>
340 <% semantic_form_for @post do |form| %>
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
341 <% inputs do %>
342 <%= form.input :title %> # => :label => "Choose a title...", :hint => "Choose a good title for you post."
343 <%= form.input :body, :hint => false %> # => :label => "Write something..."
344 <%= form.input :section, :label => 'Some section' %> # => :label => 'Some section'
345 <% end %>
4aca8cd @grimen New I18n-features:
grimen authored
346 <% buttons do %>
347 <%= form.commit_button :dummie %> # => "Launch!"
348 <% end %>
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
349 <% end %>
350 </pre>
351
352 If I18n-lookups is disabled, i.e.:
353
354 <pre>
355 Formtastic::SemanticFormBuilder.i18n_lookups_by_default = false
356 </pre>
357
358 ...then you can enable I18n within the forms instead:
359
360 <pre>
361 <% semantic_form_for @post do |form| %>
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
362 <% inputs do %>
363 <%= form.input :title, :label => true %> # => :label => "Choose a title..."
364 <%= form.input :body, :label => true %> # => :label => "Write something..."
365 <%= form.input :section, :label => true %> # => :label => I18n.t('activerecord.attributes.user.section') or 'Section'
366 <% end %>
4aca8cd @grimen New I18n-features:
grimen authored
367 % buttons do %>
368 <%= form.commit_button true %> # => "Save changes" (if we are in edit that is...)
369 <% end %>
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
370 <% end %>
371 </pre>
372
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
373 6. Advanced I18n lookups
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
374
375 For more flexible forms; Formtastic find translations using a bottom-up approach taking the following variables in account:
376
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
377 * @MODEL@, e.g. "post"
378 * @ACTION@, e.g. "edit"
4aca8cd @grimen New I18n-features:
grimen authored
379 * @KEY/ATTRIBUTE@, e.g. "title", :my_custom_key, ...
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
380
381 ...in the following order:
382
6688887 @grimen More README-polishing.
grimen authored
383 1. @formtastic.{titles,labels,hints,actions}.MODEL.ACTION.ATTRIBUTE@ - by model and action
384 2. @formtastic.{titles,labels,hints,actions}.MODEL.ATTRIBUTE@ - by model
385 3. @formtastic.{titles,labels,hints,actions}.ATTRIBUTE@ - global default
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
386
387 ...which means that you can define translations like this:
388
389 <pre>
390 en:
391 formtastic:
392 labels:
393 title: "Title" # Default global value
394 article:
395 body: "Article content"
396 post:
397 new:
398 title: "Choose a title..."
399 body: "Write something..."
400 edit:
401 title: "Edit title"
402 body: "Edit body"
403 </pre>
404
4aca8cd @grimen New I18n-features:
grimen authored
405 Values for @labels@/@hints@/@actions@ are can take values: @String@ (explicit value), @Symbol@ (i18n-lookup-key relative to the current "type", e.g. actions:), @true@ (force I18n lookup), @false@ (force no I18n lookup). Titles (legends) can only take: @String@ and @Symbol@ - true/false have no meaning.
75782e1 @grimen Updated I18n-instructions in README; on the I18n-support for fieldset…
grimen authored
406
71ef99f @justinfrench nuked the configuration copy/paste from the README, linked to the gen…
authored
407
94ce3ec @grimen Documentation for the new I18n features for labels/hints.
grimen authored
408 h2. ValidationReflection plugin
409
410 If you have the "ValidationReflection":http://github.com/redinger/validation_reflection plugin installed, you won't have to specify the :required option (it checks the validations on the model instead).
5a39443 @justinfrench bulking up the documentation and readme with the different inputs ava…
authored
411
412
71ef99f @justinfrench nuked the configuration copy/paste from the README, linked to the gen…
authored
413 h2. Configuration
5a39443 @justinfrench bulking up the documentation and readme with the different inputs ava…
authored
414
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
415 Run @./script/generate formtastic@ to copy a commented out config file into @config/initializers/formtastic.rb@. You can "view the configuration file on GitHub":http://github.com/justinfrench/formtastic/blob/master/generators/formtastic/templates/formtastic.rb
3a32b4a @josevalim Updated README with new configuration options.
josevalim authored
416
5a39443 @justinfrench bulking up the documentation and readme with the different inputs ava…
authored
417
09d957d textilized the README so that it looks pretty pretty on GitHub
Justin French authored
418 h2. Status
dcf8beb Initial Commit
Justin French authored
419
6688887 @grimen More README-polishing.
grimen authored
420 Formtastic has been in active development for about a year. We've just recently jumped to an 0.9 version number, signaling that we consider this a 1.0 release candidate, and that the API won't change significantly for the 1.x series.
c5d02e6 @justinfrench link to the wiki for the roadmap to 1.0 in README
authored
421
dcf8beb Initial Commit
Justin French authored
422
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
423 h2. Dependencies
dcf8beb Initial Commit
Justin French authored
424
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
425 There are none, but...
dcf8beb Initial Commit
Justin French authored
426
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
427 * if you have the "ValidationReflection":http://github.com/redinger/validation_reflection plugin is installed, you won't have to specify the :required option (it checks the validations on the model instead).
428 * if you want to use the @:country@ input, you'll need to install the "iso-3166-country-select plugin":http://github.com/rails/iso-3166-country-select (or any other country_select plugin with the same API).
429 * "rspec":http://github.com/dchelimsky/rspec/, "rspec_hpricot_matchers":http://rubyforge.org/projects/rspec-hpricot/ and "rcov":http://github.com/relevance/rcov gems (plus any of their own dependencies) are required for the test suite.
dcf8beb Initial Commit
Justin French authored
430
0b370ba @justinfrench Renamed input_field_set() to just inputs() and added a shorthand vers…
authored
431
9af5cc8 @justinfrench Big update and re-organization of the README:
authored
432 h2. Compatibility
0b370ba @justinfrench Renamed input_field_set() to just inputs() and added a shorthand vers…
authored
433
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
434 I'm only testing Formtastic with the latest Rails 2.2.x stable release, and it should be fine under Rails 2.3 as well (including nested forms). Patches are welcome to allow backwards compatibility, but I don't have the energy!
0b370ba @justinfrench Renamed input_field_set() to just inputs() and added a shorthand vers…
authored
435
436
67a799f @grimen Made method_required? respect the :if conditional on validates_presen…
grimen authored
437 h2. Got TextMate?
438
6688887 @grimen More README-polishing.
grimen authored
439 Well...there's a TextMate-bundle in town, dedicated to make usage of Formtastic in the "TextMate":http://macromates.com/ editor even more of a breeze:
67a799f @grimen Made method_required? respect the :if conditional on validates_presen…
grimen authored
440
441 "Formtastic.tmbundle":http://github.com/grimen/formtastic_tmbundle
2d4a72b @justinfrench big update to the README
authored
442
61d0056 @justinfrench * updated the status to reflect that this is a release candidate
authored
443
83b9eb1 @justinfrench updated the contributors list
authored
444 h2. Contributors
445
2ddd0bb @justinfrench Welcome Jose as a core maintainer :)
authored
446 Formtastic is maintained by "Justin French":http://justinfrench.com and "José Valim":http://github.com/josevalim, but it wouldn't be as awesome as it is today if it weren't for the wonderful contributions of these fine, fine coders.
ba3ce05 @justinfrench updated the README a little with contributors and some other busy work
authored
447
66c49e6 @justinfrench updated contributors list in README
authored
448 * "Jeff Smick":http://github.com/sprsquish
449 * "Tien Dung":http://github.com/tiendung
450 * "Mark Mansour":http://stateofflux.com
451 * "Andy Pearson":http://github.com/andypearson
452 * "negonicrac":http://github.com/negonicrac
5a39443 @justinfrench bulking up the documentation and readme with the different inputs ava…
authored
453 * "Xavier Shay":http://rhnh.net
15ff964 @justinfrench Added Pat and negonicrac to contributors.
authored
454 * "Pat Allan":http://github.com/freelancing-god
83b9eb1 @justinfrench updated the contributors list
authored
455 * "Gareth Townsend":http://github.com/quamen
66c49e6 @justinfrench updated contributors list in README
authored
456 * "Sascha Hoellger":http://github.com/mitnal
457 * "Andrew Carpenter":http://github.com/andrewcarpenter
83b9eb1 @justinfrench updated the contributors list
authored
458 * "Jack Dempsey":http://github.com/jackdempsey/
66c49e6 @justinfrench updated contributors list in README
authored
459 * "Greg Fitzgerald":http://github.com/gregf/
460 * "Hector E. Gomez Morales":http://github.com/hectoregm
461 * "Ben Hamill":http://blog.benhamill.com/
83b9eb1 @justinfrench updated the contributors list
authored
462 * "Simon Chiu":http://github.com/tolatomeow
66c49e6 @justinfrench updated contributors list in README
authored
463 * "Bin Dong":http://github.com/dongbin
2d4a72b @justinfrench big update to the README
authored
464
5af0311 @justinfrench updated the README to pimp the google group more
authored
465
466 h2. Hey, join the Google group!
467
468 Please join the "Formtastic Google Group":http://groups.google.com.au/group/formtastic, especially if you'd like to talk about a new feature, or report a bug.
469
470
ba3ce05 @justinfrench updated the README a little with contributors and some other busy work
authored
471 h2. Project Info
472
1fcc068 @grimen An effort to make the README somewhat more readable.
grimen authored
473 Formtastic is hosted on Github: "http://github.com/justinfrench/formtastic":http://github.com/justinfrench/formtastic, where your contributions, forkings, comments and feedback are greatly welcomed.
ba3ce05 @justinfrench updated the README a little with contributors and some other busy work
authored
474
475
25d0c7a @justinfrench fleshed out a 'roadmap to 1.0' in the README
authored
476 Copyright (c) 2007-2008 Justin French, released under the MIT license.
Something went wrong with that request. Please try again.