<%= nested_form_for(@template, :html => {:multipart => true}) do |f| %> <% if @template.errors.any? %>

<%= pluralize(@template.errors.count, "error") %> prohibited this template from being saved:

<% end %>
<%= f.label :title %>
<%= f.text_field :title %>
<%= f.label :author %>
<%= f.text_field :author %>

<%= f.file_field :thumbnail %> <%= f.hidden_field :thumbnail_cache %>

<%= f.fields_for :previews do |p| %> <%= p.file_field :image %> <%= p.hidden_field :image_cache %> <%= p.link_to_remove "Remove this file" %> <% end %>

<%= f.link_to_add "Add a file", :previews %>

<%= f.file_field :template %> <%= f.hidden_field :template_cache %>

<%= f.submit %>
<% end %>