Changed the budgets helper so just search for the current budget

This commit is contained in:
Vicente Mendoza
2018-01-25 17:10:51 +01:00
parent f4ad0b2979
commit ff5112f96b
2 changed files with 11 additions and 10 deletions

View File

@@ -52,8 +52,8 @@ module BudgetsHelper
Budget::Ballot.where(user: current_user, budget: @budget).first
end
def investment_tags_select_options
Budget::Investment.tags_on(:valuation).order(:name).select(:name).distinct
def investment_tags_select_options(budget)
Budget::Investment.where(budget_id: budget).tags_on(:valuation).order(:name).select(:name).distinct
end
def budget_published?(budget)

View File

@@ -25,14 +25,15 @@
class: "js-submit-on-change" } %>
</div>
<div class="small-12 medium-3 column">
<%= select_tag :tag_name,
options_for_select(investment_tags_select_options, params[:tag_name]),
{ prompt: t("admin.budget_investments.index.tags_filter_all"),
label: false,
class: "js-submit-on-change" } %>
</div>
<% end %>
<div class="small-12 medium-3 column">
<%= select_tag :tag_name,
options_for_select(investment_tags_select_options(@budget), params[:tag_name]),
{ prompt: t("admin.budget_investments.index.tags_filter_all"),
label: false,
class: "js-submit-on-change" } %>
</div>
<% end %>
</div>
<%= render "advanced_filters", i18n_namespace: "admin.budget_investments.index" %>