Added logic to not show invetment links is the budget phase isn't reviewing_ballots or finished

This commit is contained in:
Raúl Fuentes
2018-01-25 17:10:39 +01:00
committed by Bertocq
parent 90636daf87
commit 5b16d395e7
2 changed files with 14 additions and 5 deletions

View File

@@ -1,5 +1,9 @@
module BudgetsHelper module BudgetsHelper
def show_links_to_budget_investments(budget)
['reviewing_ballots', 'finished'].include? budget.phase
end
def heading_name_and_price_html(heading, budget) def heading_name_and_price_html(heading, budget)
content_tag :div do content_tag :div do
concat(heading.name + ' ') concat(heading.name + ' ')

View File

@@ -89,14 +89,19 @@
</div> </div>
<p> <p>
<%= link_to budget_investments_path(current_budget.id) do %> <% show_links = show_links_to_budget_investments(current_budget) %>
<small><%= t("budgets.index.investment_proyects") %></small> <% if show_links %>
<% end %><br> <%= link_to budget_investments_path(current_budget.id) do %>
<small><%= t("budgets.index.investment_proyects") %></small>
<% end %><br>
<% end %>
<%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unfeasible') do %> <%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unfeasible') do %>
<small><%= t("budgets.index.unfeasible_investment_proyects") %></small> <small><%= t("budgets.index.unfeasible_investment_proyects") %></small>
<% end %><br> <% end %><br>
<%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unselected') do %> <% if show_links %>
<small><%= t("budgets.index.not_selected_investment_proyects") %></small> <%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unselected') do %>
<small><%= t("budgets.index.not_selected_investment_proyects") %></small>
<% end %>
<% end %> <% end %>
</p> </p>
<% end %> <% end %>