Skip to content

Instantly share code, notes, and snippets.

@ozgun
Created December 3, 2012 16:34
Show Gist options
  • Save ozgun/4196135 to your computer and use it in GitHub Desktop.
Save ozgun/4196135 to your computer and use it in GitHub Desktop.
simple_form nested inputs
<%= f.input :kind, label: t('category.post.display.display') do %>
<%= f.input_field :kind, as: :select,
collection: [[t('category.post.display.full'), 'full'], [t('category.post.display.summary'), 'short'],
[t('category.post.display.word.word'), 'word']],
include_blank: false %>
<%= f.input :word_count, label: t('category.post.display.word.count'), wrapper_html: { id: 'category_word_count_div', class: 'hidden' } %>
<%= f.input :image_container, wrapper_html: { id: 'img_container', class: "hidden" }, label: t('image.image') do %>
<%= f.input_field :img, as: :boolean %>
<%= f.input :img_width, label: t('image.width'), required: false, wrapper_html: { id: 'category_img_width_div', class: 'hidden' } %>
<%= f.input :img_align, label: t('image.alignment'), as: :select, collection: [[t('left'), 'left'], [t('right'), 'right'], [t('center'), 'center']], wrapper_html: { id: 'category_img_align_div', class: 'hidden' }, include_blank: false %>
<% end %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment