From 569138cbae753c64b24cf19256c2c4964de09419 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?=
<15726+Senen@users.noreply.github.com>
Date: Mon, 16 Jan 2023 12:10:11 +0100
Subject: [PATCH] Extract view into component
---
.../table_component.html.erb | 19 ++++++++++++++++++
.../print_investments/table_component.rb | 7 +++++++
.../budgets/print_investments.html.erb | 20 +------------------
3 files changed, 27 insertions(+), 19 deletions(-)
create mode 100644 app/components/management/budgets/print_investments/table_component.html.erb
create mode 100644 app/components/management/budgets/print_investments/table_component.rb
diff --git a/app/components/management/budgets/print_investments/table_component.html.erb b/app/components/management/budgets/print_investments/table_component.html.erb
new file mode 100644
index 000000000..2159a0cfe
--- /dev/null
+++ b/app/components/management/budgets/print_investments/table_component.html.erb
@@ -0,0 +1,19 @@
+
+
+
+ | <%= t("management.budgets.table_name") %> |
+ <%= t("management.budgets.table_phase") %> |
+ <%= t("management.budgets.table_actions") %> |
+
+
+
+
+ | <%= budget.name %> |
+ <%= budget.current_phase.name %> |
+
+ <%= link_to t("management.budgets.print_investments"),
+ print_management_budget_investments_path(budget) %>
+ |
+
+
+
diff --git a/app/components/management/budgets/print_investments/table_component.rb b/app/components/management/budgets/print_investments/table_component.rb
new file mode 100644
index 000000000..4f13e14e4
--- /dev/null
+++ b/app/components/management/budgets/print_investments/table_component.rb
@@ -0,0 +1,7 @@
+class Management::Budgets::PrintInvestments::TableComponent < ApplicationComponent
+ attr_reader :budget
+
+ def initialize(budget)
+ @budget = budget
+ end
+end
diff --git a/app/views/management/budgets/print_investments.html.erb b/app/views/management/budgets/print_investments.html.erb
index 9bb4d7ea3..6e34bfe2f 100644
--- a/app/views/management/budgets/print_investments.html.erb
+++ b/app/views/management/budgets/print_investments.html.erb
@@ -1,21 +1,3 @@
<%= t("management.budgets.print_investments") %>
-
-
-
- | <%= t("management.budgets.table_name") %> |
- <%= t("management.budgets.table_phase") %> |
- <%= t("management.budgets.table_actions") %> |
-
-
-
-
- | <%= @budget.name %> |
- <%= @budget.current_phase.name %> |
-
- <%= link_to t("management.budgets.print_investments"),
- print_management_budget_investments_path(@budget) %>
- |
-
-
-
+<%= render Management::Budgets::PrintInvestments::TableComponent.new(@budget) %>