app/views/documents/new_file.html.haml
%h1 Add new file
- if flash[:notice] == "Populate all fields before submission." or flash[:notice]=="Please enter a valid URL."
#flashNotice
= flash[:notice]
%br
.container.well
=link_to documents_path, class: 'btn btn-info' do
%span.glyphicon.glyphicon-arrow-left
Back
%br
%br
= form_tag create_file_path do
.form-group
= label :file, :title, 'Title'
= text_field :file, 'title', :class => 'form-control'
.form-group
= label :file, :url, 'URL'
= text_field :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'