Code adaptation to work with nested documents and plain documents.
This commit is contained in:
33
app/views/documents/_nested_fields.html.erb
Normal file
33
app/views/documents/_nested_fields.html.erb
Normal file
@@ -0,0 +1,33 @@
|
||||
<div id="<%= document_nested_field_wrapper_id(index) %>" class="document">
|
||||
<%= hidden_field_tag :id,
|
||||
document.id,
|
||||
name: document_nested_field_name(document, index, :id),
|
||||
id: document_nested_field_id(document, index, :id) if document.persisted? %>
|
||||
<%= hidden_field_tag :user_id,
|
||||
current_user.id,
|
||||
name: document_nested_field_name(document, index, :user_id),
|
||||
id: document_nested_field_id(document, index, :user_id) %>
|
||||
<%= hidden_field_tag :cached_attachment,
|
||||
document.cached_attachment,
|
||||
name: document_nested_field_name(document, index, :cached_attachment),
|
||||
id: document_nested_field_id(document, index, :cached_attachment) %>
|
||||
|
||||
<%= label_tag :title, t("activerecord.attributes.document.title") %>
|
||||
<%= text_field_tag :title,
|
||||
document.title,
|
||||
name: document_nested_field_name(document, index, :title),
|
||||
id: document_nested_field_id(document, index, :title),
|
||||
class: "document-title" %>
|
||||
<% if document.errors[:title].any? %>
|
||||
<small class="error"><%= document.errors[:title].join(", ") %></small>
|
||||
<% end %>
|
||||
|
||||
<%= render_attachment(document, index) %>
|
||||
|
||||
<%= render_destroy_document_link(document, index) %>
|
||||
|
||||
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
|
||||
<p class="file-name"><%= document_attachment_file_name(document) %></p>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
Reference in New Issue
Block a user