Create investments helper. Fix indentation error and some specs names and structure.

This commit is contained in:
Senén Rodero Rodríguez
2017-06-23 15:01:03 +02:00
parent 4469aa9b32
commit 1327b7276d
4 changed files with 50 additions and 21 deletions

View File

@@ -9,9 +9,8 @@
class: 'button hollow float-right' %>
<% end %>
<% if author_of?(investment, current_user) || (current_user && current_user.administrator?) %>
<% button_text = investment.image.exists? ? t("budgets.investments.show.edit_image") : t("budgets.investments.show.add_image") %>
<%= link_to button_text,
<% if can?(:edit_image, @investment) %>
<%= link_to t("budgets.investments.show.#{investment_image_button_text(@investment)}"),
edit_image_budget_investment_path(investment.budget, investment),
class: 'button hollow float-right' %>
<% end %>
@@ -26,19 +25,19 @@
</div>
<br>
<% if investment.image.exists? %>
<div class="row">
<div class="small-12 column text-center">
<figure>
<%= image_tag investment.image.url(:large),
title: investment.image_title,
alt: investment.image_title %>
<figcaption class="text-right">
<em><%= investment.image_title %></em>
</figcaption>
</figure>
<hr>
<div class="row">
<div class="small-12 column text-center">
<figure>
<%= image_tag investment.image.url(:large),
title: investment.image_title,
alt: investment.image_title %>
<figcaption class="text-right">
<em><%= investment.image_title %></em>
</figcaption>
</figure>
<hr>
</div>
</div>
</div>
<% end %>
<p id="investment_code">
<%= t("budgets.investments.show.code_html", code: investment.id) %>