diff --git a/app/components/admin/budget_groups/groups_component.html.erb b/app/components/admin/budget_groups/groups_component.html.erb
new file mode 100644
index 000000000..00bcc18fc
--- /dev/null
+++ b/app/components/admin/budget_groups/groups_component.html.erb
@@ -0,0 +1,33 @@
+<% if groups.any? %>
+
<%= t("admin.budget_groups.amount", count: groups.count) %>
+
+
+
+ | <%= t("admin.budget_groups.name") %> |
+ <%= Budget::Group.human_attribute_name(:max_votable_headings) %> |
+ <%= t("admin.budget_groups.headings_name") %> |
+ <%= t("admin.actions.actions") %> |
+
+
+
+ <% groups.each do |group| %>
+
+ | <%= group.name %> |
+ <%= group.max_votable_headings %> |
+ <%= group.headings.count %> |
+
+ <%= render Admin::TableActionsComponent.new(group) do |actions| %>
+ <%= actions.link_to t("admin.budget_groups.headings_manage"),
+ admin_budget_group_headings_path(budget, group),
+ class: "headings-link" %>
+ <% end %>
+ |
+
+ <% end %>
+
+
+<% else %>
+
+ <%= t("admin.budget_groups.no_groups") %>
+
+<% end %>
diff --git a/app/components/admin/budget_groups/groups_component.rb b/app/components/admin/budget_groups/groups_component.rb
new file mode 100644
index 000000000..87012734d
--- /dev/null
+++ b/app/components/admin/budget_groups/groups_component.rb
@@ -0,0 +1,13 @@
+class Admin::BudgetGroups::GroupsComponent < ApplicationComponent
+ attr_reader :groups
+
+ def initialize(groups)
+ @groups = groups
+ end
+
+ private
+
+ def budget
+ @budget ||= groups.first.budget
+ end
+end
diff --git a/app/components/admin/budget_headings/headings_component.html.erb b/app/components/admin/budget_headings/headings_component.html.erb
new file mode 100644
index 000000000..9e32dcbe5
--- /dev/null
+++ b/app/components/admin/budget_headings/headings_component.html.erb
@@ -0,0 +1,39 @@
+<% if headings.any? %>
+ <%= t("admin.budget_headings.amount", count: headings.count) %>
+
+
+
+ | <%= Budget::Heading.human_attribute_name(:name) %> |
+ <%= Budget::Heading.human_attribute_name(:price) %> |
+ <% if budget.approval_voting? %>
+ <%= Budget::Heading.human_attribute_name(:max_ballot_lines) %> |
+ <% end %>
+ <%= Budget::Heading.human_attribute_name(:population) %> |
+ <%= Budget::Heading.human_attribute_name(:allow_custom_content) %> |
+ <%= t("admin.actions.actions") %> |
+
+
+
+ <% headings.each do |heading| %>
+
+ | <%= heading.name %> |
+ <%= budget.formatted_heading_price(heading) %> |
+ <% if budget.approval_voting? %>
+ <%= heading.max_ballot_lines %> |
+ <% end %>
+ <%= heading.population %> |
+
+ <%= heading.allow_custom_content ? t("admin.shared.true_value") : t("admin.shared.false_value") %>
+ |
+
+ <%= render Admin::TableActionsComponent.new(heading) %>
+ |
+
+ <% end %>
+
+
+<% else %>
+
+ <%= t("admin.budget_headings.no_headings") %>
+
+<% end %>
diff --git a/app/components/admin/budget_headings/headings_component.rb b/app/components/admin/budget_headings/headings_component.rb
new file mode 100644
index 000000000..3b6594f23
--- /dev/null
+++ b/app/components/admin/budget_headings/headings_component.rb
@@ -0,0 +1,17 @@
+class Admin::BudgetHeadings::HeadingsComponent < ApplicationComponent
+ attr_reader :headings
+
+ def initialize(headings)
+ @headings = headings
+ end
+
+ private
+
+ def group
+ @group ||= headings.first.group
+ end
+
+ def budget
+ @budget ||= headings.first.budget
+ end
+end
diff --git a/app/views/admin/budget_groups/index.html.erb b/app/views/admin/budget_groups/index.html.erb
index 2e20ac1ac..f89d3ee20 100644
--- a/app/views/admin/budget_groups/index.html.erb
+++ b/app/views/admin/budget_groups/index.html.erb
@@ -8,37 +8,4 @@
<%= render Admin::Budgets::HelpComponent.new("budget_groups") %>
-
-<% if @groups.any? %>
- <%= t("admin.budget_groups.amount", count: @groups.count) %>
-
-
-
- | <%= t("admin.budget_groups.name") %> |
- <%= Budget::Group.human_attribute_name(:max_votable_headings) %> |
- <%= t("admin.budget_groups.headings_name") %> |
- <%= t("admin.actions.actions") %> |
-
-
-
- <% @groups.each do |group| %>
-
- | <%= group.name %> |
- <%= group.max_votable_headings %> |
- <%= group.headings.count %> |
-
- <%= render Admin::TableActionsComponent.new(group) do |actions| %>
- <%= actions.link_to t("admin.budget_groups.headings_manage"),
- admin_budget_group_headings_path(@budget, group),
- class: "headings-link" %>
- <% end %>
- |
-
- <% end %>
-
-
-<% else %>
-
- <%= t("admin.budget_groups.no_groups") %>
-
-<% end %>
+<%= render Admin::BudgetGroups::GroupsComponent.new(@groups) %>
diff --git a/app/views/admin/budget_headings/index.html.erb b/app/views/admin/budget_headings/index.html.erb
index 4487a8f4b..f154b5ae9 100644
--- a/app/views/admin/budget_headings/index.html.erb
+++ b/app/views/admin/budget_headings/index.html.erb
@@ -6,43 +6,4 @@
<%= render Admin::Budgets::HelpComponent.new("budget_headings") %>
-
-<% if @headings.any? %>
- <%= t("admin.budget_headings.amount", count: @headings.count) %>
-
-
-
- | <%= Budget::Heading.human_attribute_name(:name) %> |
- <%= Budget::Heading.human_attribute_name(:price) %> |
- <% if @budget.approval_voting? %>
- <%= Budget::Heading.human_attribute_name(:max_ballot_lines) %> |
- <% end %>
- <%= Budget::Heading.human_attribute_name(:population) %> |
- <%= Budget::Heading.human_attribute_name(:allow_custom_content) %> |
- <%= t("admin.actions.actions") %> |
-
-
-
- <% @headings.each do |heading| %>
-
- | <%= heading.name %> |
- <%= @budget.formatted_heading_price(heading) %> |
- <% if @budget.approval_voting? %>
- <%= heading.max_ballot_lines %> |
- <% end %>
- <%= heading.population %> |
-
- <%= heading.allow_custom_content ? t("admin.shared.true_value") : t("admin.shared.false_value") %>
- |
-
- <%= render Admin::TableActionsComponent.new(heading) %>
- |
-
- <% end %>
-
-
-<% else %>
-
- <%= t("admin.budget_headings.no_headings") %>
-
-<% end %>
+<%= render Admin::BudgetHeadings::HeadingsComponent.new(@headings) %>