From 5b16d395e7c74ed469aa74cbf93b25508303c4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Fuentes?= Date: Thu, 25 Jan 2018 17:10:39 +0100 Subject: [PATCH] Added logic to not show invetment links is the budget phase isn't reviewing_ballots or finished --- app/helpers/budgets_helper.rb | 4 ++++ app/views/budgets/index.html.erb | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index 4c73f52da..90e986dad 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -1,5 +1,9 @@ module BudgetsHelper + def show_links_to_budget_investments(budget) + ['reviewing_ballots', 'finished'].include? budget.phase + end + def heading_name_and_price_html(heading, budget) content_tag :div do concat(heading.name + ' ') diff --git a/app/views/budgets/index.html.erb b/app/views/budgets/index.html.erb index 810c505ae..dffa56e1d 100644 --- a/app/views/budgets/index.html.erb +++ b/app/views/budgets/index.html.erb @@ -89,14 +89,19 @@

- <%= link_to budget_investments_path(current_budget.id) do %> - <%= t("budgets.index.investment_proyects") %> - <% end %>
+ <% show_links = show_links_to_budget_investments(current_budget) %> + <% if show_links %> + <%= link_to budget_investments_path(current_budget.id) do %> + <%= t("budgets.index.investment_proyects") %> + <% end %>
+ <% end %> <%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unfeasible') do %> <%= t("budgets.index.unfeasible_investment_proyects") %> <% end %>
- <%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unselected') do %> - <%= t("budgets.index.not_selected_investment_proyects") %> + <% if show_links %> + <%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unselected') do %> + <%= t("budgets.index.not_selected_investment_proyects") %> + <% end %> <% end %>

<% end %>