|
|
|
@ -1,14 +1,10 @@ |
|
|
|
<turbo-stream action="append" targets="#attachments"> |
|
|
|
<template> |
|
|
|
<% @attachments.each_with_index do |attachment, i| %> |
|
|
|
<%= fields_for "#{@attachable_for.class.name.underscore.singularize}[attachments_attributes][#{ Time.now.to_i + i }]", attachment do |builder| %> |
|
|
|
<%= render partial: 'admin/attachments/attachment', locals: {f: builder}, formats: :html %> |
|
|
|
<% tmp_id = Time.now.to_i + i %> |
|
|
|
<%= fields_for "#{@attachable_for.class.name.underscore.singularize}[attachments_attributes][#{ tmp_id }]", attachment do |builder| %> |
|
|
|
<%= render partial: 'admin/attachments/attachment', locals: {f: builder, tmp_id: tmp_id}, formats: :html %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
<%# fields model: @node do |form| %> |
|
|
|
<%# form.fields_for :attachments, @attachments do |builder| %> |
|
|
|
<%# render partial: 'admin/attachments/attachment', locals: {f: builder} %> |
|
|
|
<%# end%> |
|
|
|
<%# end %> |
|
|
|
<% end %> |
|
|
|
</template> |
|
|
|
</turbo-stream> |