app/views/documents/edit_file.html.haml
%h1 Edit current file
- if flash[:notice] == "Populate all fields before submission."
#flashNotice
= flash[:notice]
.container.well
= link_to documents_path do
%span.glyphicon.glyphicon-arrow-left
Back
%br
%br
= form_tag update_file_path(@id, @file), :method => :put do
.form-group
= label :file, :title, 'Title'
= text_field :file, 'title', value: @file.title, class: 'form-control'
.form-group
= label :file, :url, 'URL'
= text_field :file, 'url', value: @file.url, class: 'form-control'
.form-group
= label :file, :category_id, 'Category'
- shown_categories = @categories.map { |category| (not category.hidden?) ? [category.name, category.id] : ["tmp", "tmp"] }.to_h
- shown_categories.delete("tmp")
= select :file, :category_id, shown_categories, {}, class: 'form-control'
= submit_tag 'Submit', class: 'btn btn-success'