%= form_for @resource, :html => { :multipart => true } do |f| %> <% if @resource.errors.any? %>
<%= f.label :category_id %>
<%= select(:resource, :category_id, options_from_collection_for_select(ResourceCategory.all.sort_by(&:name), :id, :name, @resource.category_id ) ) %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :serial, "Serial" %>
<%= f.text_field :serial %>
<%= f.label :specs, "Specs" %>
<%= f.text_field :specs %>
<%= f.label :status, "Status/Location" %>
<%= f.text_field :status %>
<%= f.label :disposed_at, "Disposed?" %>
<%= f.date_select :disposed_at, include_blank: true %>
<%= f.label :user_id, "Owner" %>
<%= select(:resource, :user_id, options_from_collection_for_select(@users, :id, :name, @resource.user_id), include_blank: true) %>
<%= f.label :donatable %>
<%= f.check_box :donatable %>
<%= f.label :estimated_value, "Estimated Value" %>
<%= f.text_field :estimated_value %>
<%= f.label :picture %>
<%= f.file_field :picture %>
<%= link_to image_tag(@resource.picture.url(:tiny)), @resource.picture.url, :popup => ['form_image_preview', 'height=300,width=400'] if @resource.picture? %>
<%= f.label :notes %>
<%= f.text_area :notes %>
<%= f.submit %>
<% end %> <%= link_to 'Back', resources_path %>