app/views/machines/_form.html.haml
= simple_form_for machine do |f|
%fieldset
.text-large
General
= render "form_errors", resource: machine
= f.association :brand, hint: "Not in the list? #{link_to 'Add a new brand', new_brand_path}".html_safe
= f.input :name
= f.input :description
%fieldset
.text-large
Facilities
= render "facilities", :f => f
%fieldset
.text-large
Media
.row
.col-lg-3.p-2
- if machine.photo.present?
= image_tag machine.photo.thumb('150x150#').url, class: 'avatar big'
.col-lg-9
= f.input :photo, as: :file, label: 'Photo'
= f.hidden_field :retained_photo
%fieldset
.text-large
Tags
= f.input :tag_list, hint: 'Separate different tags with commas'
.form-check
= f.input :inventory_item, input_html: { class: 'form-check-input' }
%fieldset
= render 'form_links', f: f
= f.submit (machine.new_record? ? 'New Machine' : 'Update Machine'), class: 'btn btn-primary btn-lg mt-4'