Refs #2603 Show 'See Results' button in admin panel

This commit is contained in:
Antonis Tzorvas
2018-05-16 21:36:29 +03:00
parent 7a84d3867a
commit c21d806ecc
4 changed files with 32 additions and 4 deletions

View File

@@ -159,6 +159,10 @@ class Budget < ActiveRecord::Base
end
end
def has_winning_investments?
investments.winners.any?
end
private
def sanitize_descriptions

View File

@@ -63,6 +63,12 @@
class: "button hollow" %>
<% end %>
<% if @budget.has_winning_investments? %>
<%= link_to t("budgets.show.see_results"),
budget_results_path(@budget),
class: "button hollow margin-left" %>
<% end %>
<% if @budget.persisted? %>
<%= link_to t("admin.budgets.edit.delete"),
admin_budget_path(@budget),