diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb
index a14b86538..d2d6e1f5d 100644
--- a/app/helpers/budgets_helper.rb
+++ b/app/helpers/budgets_helper.rb
@@ -6,26 +6,6 @@ module BudgetsHelper
csv_params
end
- def investment_selected_link(investment)
- options = investment_selected_link_options(investment)
- path = toggle_selection_admin_budget_budget_investment_path(@budget,
- investment, filter: params[:filter], page: params[:page])
- link_options = {method: :patch, remote: true, class: options[:link_class]}
- link_to options[:text], path, link_options
- end
-
- def investment_selected_link_options(investment)
- if investment.selected?
- {link_class: "button small expanded",
- text: t("admin.budget_investments.index.selected") }
- elsif investment.feasible? && investment.valuation_finished?
- {link_class: "button small hollow expanded",
- text: t("admin.budget_investments.index.select")}
- else
- {}
- end
- end
-
def budget_phases_select_options
Budget::PHASES.map { |ph| [ t("budgets.phase.#{ph}"), ph ] }
end
diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb
index 75bde7002..0299b6149 100644
--- a/app/views/admin/budget_investments/_investments.html.erb
+++ b/app/views/admin/budget_investments/_investments.html.erb
@@ -1,5 +1,8 @@
- <%= link_to 'download current selecction',admin_budget_budget_investments_path(csv_params), class: 'advanced-search small' %>
+ <%= link_to t("admin.budget_investments.index.download_current_selection"),
+ admin_budget_budget_investments_path(csv_params),
+ class: 'advanced-search small' %>
+
<%= page_entries_info @investments %>
@@ -27,14 +30,19 @@
<%= investment.id %>
- <%= link_to investment.title, admin_budget_budget_investment_path(budget_id: @budget.id, id: investment.id, params: Budget::Investment.filter_params(params)) %>
+ <%= link_to investment.title,
+ admin_budget_budget_investment_path(budget_id: @budget.id,
+ id: investment.id,
+ params: Budget::Investment.filter_params(params)) %>
|
<%= investment.total_votes %>
|
<% if investment.administrator.present? %>
- <%= investment.administrator.name %>
+
+ <%= investment.administrator.name %>
+
<% else %>
<%= t("admin.budget_investments.index.no_admin_assigned") %>
<% end %>
@@ -58,7 +66,27 @@
<%= investment.valuation_finished? ? t('shared.yes'): t('shared.no') %>
|
- <%= investment_selected_link(investment) %>
+ <% if investment.selected? %>
+ <%= link_to_unless investment.budget.finished?,
+ t("admin.budget_investments.index.selected"),
+ toggle_selection_admin_budget_budget_investment_path(@budget,
+ investment,
+ filter: params[:filter],
+ page: params[:page]),
+ method: :patch,
+ remote: true,
+ class: "button small expanded" %>
+ <% elsif investment.feasible? && investment.valuation_finished? %>
+ <%= link_to_unless investment.budget.finished?,
+ t("admin.budget_investments.index.select"),
+ toggle_selection_admin_budget_budget_investment_path(@budget,
+ investment,
+ filter: params[:filter],
+ page: params[:page]),
+ method: :patch,
+ remote: true,
+ class: "button small hollow expanded" %>
+ <% end %>
|
<% if params[:filter] == 'selected' %>
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index 0d83e824b..0045f0991 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -138,6 +138,7 @@ en:
undecided: "Undecided"
selected: "Selected"
select: "Select"
+ download_current_selection: "Download current selection"
table_id: "ID"
table_title: "Title"
table_supports: "Supports"
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 456b78ab3..ff886a02d 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -139,6 +139,7 @@ es:
undecided: "Sin decidir"
selected: "Seleccionada"
select: "Seleccionar"
+ download_current_selection: "Descargar selección actual"
table_id: "ID"
table_title: "Título"
table_supports: "Apoyos"
diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb
index c3fc69473..aab577f4a 100644
--- a/spec/features/admin/budget_investments_spec.rb
+++ b/spec/features/admin/budget_investments_spec.rb
@@ -639,7 +639,10 @@ feature 'Admin budget investments' do
admin = create(:administrator, user: create(:user, username: 'Gema'))
investment.update(administrator_id: admin.id)
- visit admin_budget_budget_investments_path(@budget, format: :csv)
+ visit admin_budget_budget_investments_path(@budget)
+ within('#filter-subnav') { click_link 'All' }
+
+ click_link "Download current selection"
header = page.response_headers['Content-Disposition']
expect(header).to match(/^attachment/)
@@ -666,8 +669,11 @@ feature 'Admin budget investments' do
title: 'compatible')
investment2 = create(:budget_investment, :finished, budget: @budget,
title: 'finished')
- visit admin_budget_budget_investments_path(@budget, format: :csv,
- filter: :valuation_finished)
+
+ visit admin_budget_budget_investments_path(@budget)
+ within('#filter-subnav') { click_link 'Valuation finished' }
+
+ click_link "Download current selection"
header = page.response_headers['Content-Disposition']
header.should match(/^attachment/)
|