diff --git a/app/components/valuation/budgets/index_component.html.erb b/app/components/valuation/budgets/index_component.html.erb
new file mode 100644
index 000000000..d4ecb28d5
--- /dev/null
+++ b/app/components/valuation/budgets/index_component.html.erb
@@ -0,0 +1,21 @@
+
<%= t("valuation.budgets.index.title") %>
+
+<% if budget.present? %>
+
+
+
+ | <%= t("valuation.budgets.index.table_name") %> |
+ <%= t("valuation.budgets.index.table_phase") %> |
+ <%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %> |
+ <%= t("valuation.budgets.index.table_actions") %> |
+
+
+
+ <%= render Valuation::Budgets::RowComponent.new(budget) %>
+
+
+<% else %>
+
+ <%= t("valuation.budgets.index.no_budgets") %>
+
+<% end %>
diff --git a/app/components/valuation/budgets/index_component.rb b/app/components/valuation/budgets/index_component.rb
new file mode 100644
index 000000000..40138ac88
--- /dev/null
+++ b/app/components/valuation/budgets/index_component.rb
@@ -0,0 +1,7 @@
+class Valuation::Budgets::IndexComponent < ApplicationComponent
+ attr_reader :budget
+
+ def initialize(budget)
+ @budget = budget
+ end
+end
diff --git a/app/components/valuation/budgets/row_component.html.erb b/app/components/valuation/budgets/row_component.html.erb
new file mode 100644
index 000000000..be3fc52c5
--- /dev/null
+++ b/app/components/valuation/budgets/row_component.html.erb
@@ -0,0 +1,16 @@
+
+ |
+ <%= budget.name %>
+ |
+
+ <%= budget.current_phase.name %>
+ |
+
+ <%= investments_count %>
+ |
+
+ <%= link_to t("valuation.budgets.index.evaluate"),
+ valuation_budget_budget_investments_path(budget_id: budget.id),
+ class: "button hollow expanded" %>
+ |
+
diff --git a/app/components/valuation/budgets/row_component.rb b/app/components/valuation/budgets/row_component.rb
new file mode 100644
index 000000000..46fff464a
--- /dev/null
+++ b/app/components/valuation/budgets/row_component.rb
@@ -0,0 +1,13 @@
+class Valuation::Budgets::RowComponent < ApplicationComponent
+ attr_reader :budget
+
+ delegate :current_user, to: :helpers
+
+ def initialize(budget)
+ @budget = budget
+ end
+
+ def investments_count
+ budget.investments.by_valuator(current_user.valuator).valuation_open.count
+ end
+end
diff --git a/app/controllers/valuation/budgets_controller.rb b/app/controllers/valuation/budgets_controller.rb
index 0165fb0e2..a30ccc55e 100644
--- a/app/controllers/valuation/budgets_controller.rb
+++ b/app/controllers/valuation/budgets_controller.rb
@@ -6,8 +6,5 @@ class Valuation::BudgetsController < Valuation::BaseController
def index
@budget = current_budget
- if @budget.present?
- @investments = @budget.investments.by_valuator(current_user.valuator).valuation_open
- end
end
end
diff --git a/app/views/valuation/budgets/index.html.erb b/app/views/valuation/budgets/index.html.erb
index fae10257b..5f2db605c 100644
--- a/app/views/valuation/budgets/index.html.erb
+++ b/app/views/valuation/budgets/index.html.erb
@@ -1,36 +1 @@
-<%= t("valuation.budgets.index.title") %>
-
-<% if @budget.present? %>
-
-
-
- | <%= t("valuation.budgets.index.table_name") %> |
- <%= t("valuation.budgets.index.table_phase") %> |
- <%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %> |
- <%= t("valuation.budgets.index.table_actions") %> |
-
-
-
-
- |
- <%= @budget.name %>
- |
-
- <%= @budget.current_phase.name %>
- |
-
- <%= @investments.count %>
- |
-
- <%= link_to t("valuation.budgets.index.evaluate"),
- valuation_budget_budget_investments_path(budget_id: @budget.id),
- class: "button hollow expanded" %>
- |
-
-
-
-<% else %>
-
- <%= t("valuation.budgets.index.no_budgets") %>
-
-<% end %>
+<%= render Valuation::Budgets::IndexComponent.new(@budget) %>