diff --git a/.gitignore b/.gitignore
index 0413aaa36..c7ecd304f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,4 @@
public/sitemap.xml
public/system/
/public/ckeditor_assets/
+.idea/
diff --git a/app/views/admin/budget_investments/_investments.html.erb b/app/views/admin/budget_investments/_investments.html.erb
index a3a512366..81b46f9d3 100644
--- a/app/views/admin/budget_investments/_investments.html.erb
+++ b/app/views/admin/budget_investments/_investments.html.erb
@@ -57,87 +57,7 @@
<% @investments.each do |investment| %>
- |
- <%= investment.id %>
- |
-
- <%= link_to investment.title,
- admin_budget_budget_investment_path(budget_id: @budget.id,
- id: investment.id,
- params: Budget::Investment.filter_params(params)),
- target: "_blank" %>
- |
-
- <%= investment.total_votes %>
- |
-
- <% if investment.administrator.present? %>
- ">
- <%= investment.administrator.name %>
-
- <% else %>
- <%= t("admin.budget_investments.index.no_admin_assigned") %>
- <% end %>
- |
-
- <% no_valuation_groups = t("admin.budget_investments.index.no_valuation_groups") %>
- <%= investment.assigned_valuation_groups || no_valuation_groups %>
-
- <% no_valuators_assigned = t("admin.budget_investments.index.no_valuators_assigned") %>
- <%= investment.assigned_valuators || no_valuators_assigned %>
- |
-
- <%= investment.heading.name %>
- |
-
- <%= t("admin.budget_investments.index.feasibility.#{investment.feasibility}",
- price: investment.formatted_price) %>
- |
-
- <%= investment.valuation_finished? ? t("shared.yes"): t("shared.no") %>
- |
-
- <%= form_for [:admin, investment.budget, investment], remote: true do |f| %>
- <%= f.check_box :visible_to_valuators,
- label: false,
- class: "js-submit-on-change",
- id: "budget_investment_visible_to_valuators" %>
- <% end %>
- |
-
- <% 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],
- sort_by: params[:sort_by],
- min_total_supports: params[:min_total_supports],
- advanced_filters: params[:advanced_filters],
- 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],
- sort_by: params[:sort_by],
- min_total_supports: params[:min_total_supports],
- advanced_filters: params[:advanced_filters],
- page: params[:page]),
- method: :patch,
- remote: true,
- class: "button small hollow expanded" %>
- <% end %>
- |
- <% if params[:filter] == "selected" %>
-
- <%= investment.incompatible? ? t("shared.yes"): t("shared.no") %>
- |
- <% end %>
+ <%= render '/admin/budget_investments/select_investment', investment: investment %>
<% end %>
diff --git a/app/views/admin/budget_investments/_select_investment.html.erb b/app/views/admin/budget_investments/_select_investment.html.erb
new file mode 100644
index 000000000..12bb5c5c8
--- /dev/null
+++ b/app/views/admin/budget_investments/_select_investment.html.erb
@@ -0,0 +1,81 @@
+
+ <%= investment.id %>
+ |
+
+ <%= link_to investment.title,
+ admin_budget_budget_investment_path(budget_id: @budget.id,
+ id: investment.id,
+ params: Budget::Investment.filter_params(params)),
+ target: "_blank" %>
+ |
+
+ <%= investment.total_votes %>
+ |
+
+ <% if investment.administrator.present? %>
+ ">
+ <%= investment.administrator.name %>
+
+ <% else %>
+ <%= t("admin.budget_investments.index.no_admin_assigned") %>
+ <% end %>
+ |
+
+ <% no_valuation_groups = t("admin.budget_investments.index.no_valuation_groups") %>
+ <%= investment.assigned_valuation_groups || no_valuation_groups %>
+
+ <% no_valuators_assigned = t("admin.budget_investments.index.no_valuators_assigned") %>
+ <%= investment.assigned_valuators || no_valuators_assigned %>
+ |
+
+ <%= investment.heading.name %>
+ |
+
+ <%= t("admin.budget_investments.index.feasibility.#{investment.feasibility}",
+ price: investment.formatted_price) %>
+ |
+
+ <%= investment.valuation_finished? ? t("shared.yes"): t("shared.no") %>
+ |
+
+ <%= form_for [:admin, investment.budget, investment], remote: true do |f| %>
+ <%= f.check_box :visible_to_valuators,
+ label: false,
+ class: "js-submit-on-change",
+ id: "budget_investment_visible_to_valuators" %>
+ <% end %>
+ |
+
+ <% 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],
+ sort_by: params[:sort_by],
+ min_total_supports: params[:min_total_supports],
+ advanced_filters: params[:advanced_filters],
+ 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],
+ sort_by: params[:sort_by],
+ min_total_supports: params[:min_total_supports],
+ advanced_filters: params[:advanced_filters],
+ page: params[:page]),
+ method: :patch,
+ remote: true,
+ class: "button small hollow expanded" %>
+ <% end %>
+ |
+<% if params[:filter] == "selected" %>
+
+ <%= investment.incompatible? ? t("shared.yes"): t("shared.no") %>
+ |
+<% end %>
diff --git a/app/views/admin/budget_investments/toggle_selection.js.erb b/app/views/admin/budget_investments/toggle_selection.js.erb
index dc3a8d67a..3074847d6 100644
--- a/app/views/admin/budget_investments/toggle_selection.js.erb
+++ b/app/views/admin/budget_investments/toggle_selection.js.erb
@@ -1 +1 @@
-$("#investments").html('<%= j render("admin/budget_investments/investments") %>');
+$("#<%= dom_id(@investment) %>").html('<%= j render("select_investment", investment: @investment) %>');