Files
grecia/app/views/images/_nested_fields.html.erb
2017-09-26 13:57:13 +02:00

50 lines
1.9 KiB
Plaintext

<div id="<%= image_nested_field_wrapper_id %>" class="image direct-upload">
<%= hidden_field_tag :id,
image.id,
name: image_nested_field_name(image, :id),
id: image_nested_field_id(image, :id) if image.persisted? %>
<%= hidden_field_tag :user_id,
current_user.id,
name: image_nested_field_name(image, :user_id),
id: image_nested_field_id(image, :user_id) %>
<%= hidden_field_tag :cached_attachment,
image.cached_attachment,
name: image_nested_field_name(image, :cached_attachment),
id: image_nested_field_id(image, :cached_attachment) %>
<div class="small-12 column">
<%= label_tag :title, t("activerecord.attributes.image.title") %>
<%= text_field_tag :title,
image.title,
placeholder: t("images.new.form.title_placeholder"),
name: image_nested_field_name(image, :title),
id: image_nested_field_id(image, :title),
class: "image-title" %>
<% if image.errors[:title].any? %>
<small class="error"><%= image.errors[:title].join(", ") %></small>
<% end %>
</div>
<%= render_image(image, :thumb, false) if image.attachment.exists? %>
<div class="small-12 column attachment-actions">
<div class="small-9 column action-add attachment-errors image-attachment">
<%= render_image_attachment(image) %>
</div>
<div class="small-3 column action-remove text-right">
<%= render_destroy_image_link(image) %>
</div>
</div>
<div class="small-6 column">
<p class="file-name">
<%= image_attachment_file_name(image) %>
</p>
</div>
<div class="small-12 column">
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
</div>
</div>