<%= form_for @document, url: documents_path( documentable_type: @document.documentable_type, documentable_id: @document.documentable_id, from: params[:from] ), html: { multipart: true, class: "documentable"}, data: { direct_upload_url: upload_documents_url(documentable_type: @document.documentable_type, documentable_id: @document.documentable_id) } do |f| %> <%= render 'shared/errors', resource: @document %>
<%= f.text_field :title %>
<%= f.hidden_field :cached_attachment %> <%= f.file_field :attachment, accept: accepted_content_types_extensions(@document.documentable.class), label: false, class: 'document_ajax_attachment show-for-sr', data: { url: upload_documents_url(documentable_type: @document.documentable_type, documentable_id: @document.documentable_id), cached_attachment_input_field: "document_cached_attachment", multiple: false } %> <%= f.label :attachment, t("documents.form.attachment_label"), class: 'button hollow' %>

<%= document_attachment_file_name(@document) %>

<% if @document.errors.has_key?(:attachment) %>
<%= errors_on_attachment(@document)%>
<% end %>
<%= f.submit(t("documents.form.submit_button"), class: "button expanded") %>
<% end %>