Add edit_image and update_image action to budget/investments controller.
This commit is contained in:
29
app/views/budgets/investments/_image_form.html.erb
Normal file
29
app/views/budgets/investments/_image_form.html.erb
Normal 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 %>
|
||||
@@ -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">
|
||||
|
||||
10
app/views/budgets/investments/edit_image.html.erb
Normal file
10
app/views/budgets/investments/edit_image.html.erb
Normal 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>
|
||||
Reference in New Issue
Block a user