Add edit_image and update_image action to budget/investments controller.

This commit is contained in:
Senén Rodero Rodríguez
2017-06-21 12:56:01 +02:00
parent 515d6d7e70
commit acc79cbe31
14 changed files with 167 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
<%= form_for([@investment.budget, @investment], url: update_image_budget_investment_path(@investment.budget, @investment), multipart: true, method: :put) do |f| %>
<%= render 'shared/errors', resource: @investment %>
<div class="row">
<div class="small-12 column">
<span class="note-marked">
<%= t("budgets.investments.edit_image.note", title: @investment.title) %></p>
</span>
</div>
<div class="small-12 column">
<%= image_tag @investment.image.url(:large) %>
</div>
<div class="small-12 column">
<%= f.file_field :image, accept: 'image/jpeg' %>
</div>
<div class="small-12 column">
<%= f.label :image_title, t("budgets.investments.edit_image.form.image_title") %>
<%= f.text_field :image_title, placeholder: t("budgets.investments.edit_image.form.image_title"), label: false %>
</div>
<div class="actions small-12 column">
<%= f.submit(class: "button", value: t("budgets.investments.edit_image.form.submit_button")) %>
</div>
</div>
<% end %>

View File

@@ -10,6 +10,12 @@
class: 'button hollow float-right' %>
<% end %>
<% if author_of?(investment, current_user) %>
<%= link_to t("budgets.investments.show.edit_image"),
edit_image_budget_investment_path(investment.budget, investment),
class: 'button hollow float-right' %>
<% end %>
<h1><%= investment.title %></h1>
<div class="budget-investment-info">

View File

@@ -0,0 +1,10 @@
<div class="budget-investment-image-edit row">
<div class="small-12 column">
<%= render "shared/back_link" %>
<h1><%= t("budgets.investments.edit_image.title") %></h1>
<%= render "image_form" %>
</div>
</div>