· 1 min read
Screencast: Simple Form
Download:
Download(14.7 MB, 7:50) Alternativer Download für iPod & Apple TV(13.7 MB, 7:50)
Resourcen:
Quellcode:
[bash] bundle_install rails g simple_form:install [/bash]
[html] <%= simple_form_for @product do |f| %> <%= f.error_messages %> <%= f.input :name %> <%= f.input :price, :hint => “prices should be in USD” %> <%= f.input :released_on %> <%= f.association :category, :include_blank => false %> <%= f.input :rating, :collection => 1..5, :as => :radio %> <%= f.input :discontinued %> <%= f.button :submit %> <% end %> [/html]
[css] /* stylesheets/application.css */ .simple_form label { float: left; width: 100px; text-align: right; margin: 2px 10px; }
.simple_form div.input { margin-bottom: 10px; }
.simple_form div.boolean, .simple_form input[type=‘submit’] { margin-left: 120px; }
.simple_form div.boolean label, .simple_form label.collection_radio { float: none; margin: 0; }
.simple_form label.collection_radio { margin-right: 10px; margin-left: 2px; }
.simple_form .error { clear: left; margin-left: 120px; font-size: 12px; color: #D00; display: block; }
.simple_form .hint { clear: left; margin-left: 120px; font-size: 12px; color: #555; display: block; font-style: italic; } [/css]