Open-Source-Access-Control-.../app/views/resources/_form.html.erb
2014-02-09 05:01:52 -07:00

74 lines
1.8 KiB
Plaintext

<%= form_for @resource, :html => { :multipart => true } do |f| %>
<% if @resource.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@resource.errors.count, "error") %> prohibited this resource from being saved:</h2>
<ul>
<% @resource.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.label :category_id %><br />
<%= select(:resource, :category_id, options_from_collection_for_select(ResourceCategory.all.sort_by(&:name), :id, :name, @resource.category_id ) ) %>
</p>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :serial, "Serial" %>
<br />
<%= f.text_field :serial %>
</p>
<p>
<%= f.label :specs, "Specs" %>
<br/>
<%= f.text_field :specs %>
</p>
<p>
<%= f.label :status, "Status/Location" %>
<br/>
<%= f.text_field :status %>
</p>
<p>
<%= f.label :disposed_at, "Disposed?" %><br />
<%= f.date_select :disposed_at, include_blank: true %>
</p>
<p>
<%= f.label :user_id, "Owner" %>
<br />
<%= select(:resource, :user_id, options_from_collection_for_select(@users, :id, :name, @resource.user_id), include_blank: true) %>
</p>
<p>
<%= f.label :donatable %><br />
<%= f.check_box :donatable %>
</p>
<p>
<%= f.label :estimated_value, "Estimated Value" %><br />
<%= f.text_field :estimated_value %>
</p>
<p>
<%= f.label :picture %><br />
<%= 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? %>
</p>
<p>
<%= f.label :notes %><br />
<%= f.text_area :notes %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
<%= link_to 'Back', resources_path %>