Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

always use inputs() block in README examples, less chance of WTF moments

  • Loading branch information...
commit 600e013ad2fee3eeb35286b356e86d27ea55bc5f 1 parent 2e04c06
@justinfrench authored
Showing with 23 additions and 13 deletions.
  1. +23 −13 README.textile
View
36 README.textile
@@ -239,9 +239,11 @@ If you have more than one form on the same page, it may lead to HTML invalidatio
<pre>
<%= semantic_form_for(@post, :namespace => 'cat_form') do |form| %>
- <%= form.input :title %> # id="cat_form_post_title"
- <%= form.input :body %> # id="cat_form_post_body"
- <%= form.input :created_at %> # id="cat_form_post_created_at"
+ <%= f.inputs do %>
@twalpole Collaborator

Should these be form.inputs instead of f.inputs

@sobrinho Collaborator

Could you submit a pull request fixing that?

@justinfrench Owner

No, it's my fuck-up, I'll fix.

@justinfrench Owner

Fixed in 913215e

@sobrinho Collaborator

Fine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <%= form.input :title %> # id="cat_form_post_title"
+ <%= form.input :body %> # id="cat_form_post_body"
+ <%= form.input :created_at %> # id="cat_form_post_created_at"
+ <% end %>
<%= form.buttons %>
<% end %>
</pre>
@@ -250,9 +252,11 @@ Customize HTML attributes for any input using the @:input_html@ option. Typicall
<pre>
<%= semantic_form_for @post do |form| %>
- <%= form.input :title, :input_html => { :cols => 10 } %>
- <%= form.input :body, :input_html => { :class => 'autogrow', :rows => 10, :cols => 20, :maxlength => 10 } %>
- <%= form.input :created_at, :input_html => { :disabled => true } %>
+ <%= f.inputs do %>
+ <%= form.input :title, :input_html => { :cols => 10 } %>
+ <%= form.input :body, :input_html => { :class => 'autogrow', :rows => 10, :cols => 20, :maxlength => 10 } %>
+ <%= form.input :created_at, :input_html => { :disabled => true } %>
+ <% end %>
<%= form.buttons %>
<% end %>
</pre>
@@ -272,9 +276,11 @@ Customize the HTML attributes for the @<li>@ wrapper around every input with the
<pre>
<%= semantic_form_for @post do |form| %>
- <%= form.input :title, :wrapper_html => { :class => "important" } %>
- <%= form.input :body %>
- <%= form.input :description, :wrapper_html => { :style => "display:none;" } %>
+ <%= f.inputs do %>
+ <%= form.input :title, :wrapper_html => { :class => "important" } %>
+ <%= form.input :body %>
+ <%= form.input :description, :wrapper_html => { :style => "display:none;" } %>
+ <% end %>
...
<% end %>
</pre>
@@ -283,7 +289,9 @@ Customize the default class used for hints on each attribute or globally in the
<pre>
<%= semantic_form_for @post do |form| %>
- <%= form.input :title, :hint_class => 'custom-html-class', :error_class => 'custom-error-class' %>
+ <%= f.inputs do %>
+ <%= form.input :title, :hint_class => 'custom-html-class', :error_class => 'custom-error-class' %>
+ <% end %>
<% end %>
</pre>
@@ -354,9 +362,11 @@ Basic localization (labels only, with ActiveRecord):
<pre>
<%= semantic_form_for @post do |form| %>
- <%= form.input :title %> # => :label => I18n.t('activerecord.attributes.user.title') or 'Title'
- <%= form.input :body %> # => :label => I18n.t('activerecord.attributes.user.body') or 'Body'
- <%= form.input :section %> # => :label => I18n.t('activerecord.attributes.user.section') or 'Section'
+ <%= f.inputs do %>
+ <%= form.input :title %> # => :label => I18n.t('activerecord.attributes.user.title') or 'Title'
+ <%= form.input :body %> # => :label => I18n.t('activerecord.attributes.user.body') or 'Body'
+ <%= form.input :section %> # => :label => I18n.t('activerecord.attributes.user.section') or 'Section'
+ <% end %>
<% end %>
</pre>
@twalpole
Collaborator

Should these be form.inputs instead of f.inputs

@sobrinho
Collaborator

Could you submit a pull request fixing that?

@justinfrench

No, it's my fuck-up, I'll fix.

@sobrinho
Collaborator

Fine :)

Please sign in to comment.
Something went wrong with that request. Please try again.