Allow to remove budget investment image from edit image page to authors and administrators.

This commit is contained in:
Senén Rodero Rodríguez
2017-06-23 14:23:58 +02:00
parent 943ef06ec8
commit 4469aa9b32
11 changed files with 85 additions and 8 deletions

View File

@@ -17,7 +17,7 @@
<%= f.file_field :image, accept: 'image/jpeg', label: false, class:'show-for-sr' %>
<br>
<%= f.label :image, t("images.upload_image"), class:'button' %>
<p><%= @investment.image.url.split('/').last.split("?")[0] %></p>
<p><%= @investment.image.url.split('/').last.split("?")[0] if @investment.image.exists?%></p>
</div>
</div>
<div class="small-12 column">
@@ -26,6 +26,13 @@
</div>
<div class="actions small-12 column">
<%= f.submit(class: "button", value: t("budgets.investments.edit_image.form.submit_button")) %>
<% if @investment.image.exists? %>
<%= link_to t("budgets.investments.edit_image.form.remove_button"),
remove_image_budget_investment_path(@investment.budget, @investment),
class: "button hollow alert",
method: :delete,
data: { confirm: "¿Está seguro que desea eliminar la imagen del proyecto?" } %>
<% end %>
</div>
</div>
<% end %>