Remove duplicate nested image partial

It had almost exactly the same code as the standard nested image
partial, and its variations were insignificant.
This commit is contained in:
Javi Martín
2021-06-20 13:19:02 +02:00
parent 3f9614fbe1
commit 7db4a91d78
5 changed files with 3 additions and 47 deletions

View File

@@ -27,7 +27,7 @@
<div class="column">
<%= f.date_field :publication_date %>
<%= render "images/admin_image", imageable: @milestone, f: f %>
<%= render "images/nested_image", imageable: @milestone, f: f %>
<div class="documents">
<%= render "documents/nested_documents", documentable: @milestone, f: f %>

View File

@@ -32,8 +32,8 @@
</div>
<div class="row">
<div class="small-12 column">
<%= render "images/admin_image", imageable: @poll, f: f %>
<div class="images small-12 column">
<%= render "images/nested_image", imageable: @poll, f: f %>
</div>
<div class="clear">

View File

@@ -1,40 +0,0 @@
<div class="images">
<div>
<%= f.label :image, t("images.form.admin_title") %>
<%= link_to_add_association t("images.form.add_new_image"), f, :image,
force_non_association_create: true,
partial: "images/image_fields",
id: "new_image_link",
class: "button hollow",
render_options: {
locals: { imageable: imageable }
},
data: {
association_insertion_node: "#nested-image",
association_insertion_method: "append"
} %>
<%= render_image(f.object.image, :thumb, false) if f.object.image %>
<div id="nested-image">
<%= f.fields_for :image do |image_builder| %>
<div id="<%= dom_id(image_builder.object) %>" class="image direct-upload nested-fields">
<%= image_builder.hidden_field :id %>
<%= image_builder.hidden_field :user_id, value: current_user.id %>
<%= image_builder.hidden_field :cached_attachment %>
<%= image_builder.text_field :title, placeholder: t("images.form.title_placeholder"), label: "#{t("images.form.admin_alt_text")}" %>
<div class="attachment-actions">
<div class="small-12 column action-add attachment-errors image-attachment">
<%= render_image_attachment(image_builder, imageable, image_builder.object) %>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>

View File

@@ -8,8 +8,6 @@ en:
note: "You can upload one image of following content types: %{accepted_content_types}, up to %{max_file_size} MB."
add_new_image: Add image
title_placeholder: Add a descriptive title for the image
admin_title: "Image"
admin_alt_text: "Alternative text for the image"
actions:
destroy:
notice: Image was deleted successfully.

View File

@@ -7,8 +7,6 @@ es:
delete_button: Eliminar imagen
note: "Puedes subir una imagen en los formatos: %{accepted_content_types}, y de hasta %{max_file_size} MB por archivo."
add_new_image: Añadir imagen
admin_title: "Imagen"
admin_alt_text: "Texto alternativo para la imagen"
actions:
destroy:
notice: La imagen se ha eliminado correctamente.