Open-Source-Access-Control-.../app/views/resources/_form.html.erb

80 lines
2.2 KiB
Plaintext
Raw Normal View History

2014-02-14 08:09:16 +00:00
<%= form_for @resource, :html => { :multipart => true, class: "col-sm-6" } do |f| %>
2014-02-09 10:42:17 +00:00
<% 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 :resource_category_id, "Category" %><br />
2014-02-14 08:09:16 +00:00
<%= select(:resource, :resource_category_id, options_from_collection_for_select(ResourceCategory.all.sort_by(&:name), :id, :name, @resource.resource_category_id ), {}, {class: "form-control"} ) %>
2014-02-09 10:42:17 +00:00
</p>
<p>
<%= f.label :name %><br />
2014-02-14 08:09:16 +00:00
<%= f.text_field :name, class: "form-control" %>
2014-02-09 10:42:17 +00:00
</p>
<p>
<%= f.label :serial, "Serial" %>
<br />
2014-02-14 08:09:16 +00:00
<%= f.text_field :serial, class: "form-control" %>
2014-02-09 10:42:17 +00:00
</p>
<p>
<%= f.label :specs, "Specs" %>
<br/>
2014-02-14 08:09:16 +00:00
<%= f.text_field :specs, class: "form-control" %>
2014-02-09 10:42:17 +00:00
</p>
<p>
<%= f.label :status, "Status/Location" %>
<br/>
2014-02-14 08:09:16 +00:00
<%= f.text_field :status, class: "form-control" %>
2014-02-09 10:42:17 +00:00
</p>
2014-02-09 11:32:45 +00:00
<p>
<%= f.label :disposed_at, "Disposed?" %><br />
<%= f.date_select :disposed_at, include_blank: true %>
</p>
2014-02-09 10:42:17 +00:00
<p>
<%= f.label :user_id, "Owner" %>
<br />
2014-02-14 08:09:16 +00:00
<%= select(:resource, :user_id, options_from_collection_for_select(@users, :id, :name, @resource.user_id), {include_blank: true}, {class: "form-control"}) %>
2014-02-09 10:42:17 +00:00
</p>
<p>
<%= f.label :donatable %><br />
<%= f.check_box :donatable %>
</p>
<p>
<%= f.label :estimated_value, "Estimated Value" %><br />
2014-02-14 08:09:16 +00:00
<%= f.text_field :estimated_value, class: "form-control" %>
2014-02-09 10:42:17 +00:00
</p>
2014-02-14 08:09:16 +00:00
<% [:picture, :picture2, :picture3, :picture4].each do |p| %>
<p class="row">
<span class="col-sm-3">
<%= f.label p %><br />
<%= f.file_field p %>
</span>
<span class="col-sm-2">
<%= link_to image_tag(@resource.send(p).url(:tiny)), @resource.send(p).url unless @resource.send(p).blank? %>
</span>
</p>
<% end %>
2014-02-09 10:42:17 +00:00
<p>
<%= f.label :notes %><br />
2014-02-14 08:09:16 +00:00
<%= f.text_area :notes, class: "form-control" %>
2014-02-09 10:42:17 +00:00
</p>
<p>
2014-02-14 08:09:16 +00:00
<%= f.submit nil, class: "btn btn-primary" %>
2014-02-09 10:42:17 +00:00
</p>
<% end %>