Extract SDG configuration tab partial to a component

This commit is contained in:
Senén Rodero Rodríguez
2024-01-18 17:04:09 +01:00
committed by Javi Martín
parent f32d7edcf3
commit 047cb2b76c
3 changed files with 13 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
<h2><%= t("admin.settings.index.sdg.title") %></h2> <h2><%= t("admin.settings.index.sdg.title") %></h2>
<%= render Admin::Settings::TableComponent.new(setting_name: "feature", table_class: "featured-settings-table") do %> <%= render Admin::Settings::TableComponent.new(setting_name: "feature", table_class: "featured-settings-table") do %>
<% %w[sdg.process.debates sdg.process.proposals sdg.process.polls sdg.process.budgets sdg.process.legislation].each do |key| %> <% settings.each do |key| %>
<%= render Admin::Settings::RowComponent.new(key, type: :feature, tab: "#tab-sdg-configuration") %> <%= render Admin::Settings::RowComponent.new(key, type: :feature, tab: "#tab-sdg-configuration") %>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -0,0 +1,11 @@
class Admin::Settings::SDGConfigurationTabComponent < ApplicationComponent
def settings
%w[
sdg.process.debates
sdg.process.proposals
sdg.process.polls
sdg.process.budgets
sdg.process.legislation
]
end
end

View File

@@ -31,6 +31,6 @@
</div> </div>
<div class="tabs-panel" id="tab-sdg-configuration"> <div class="tabs-panel" id="tab-sdg-configuration">
<%= render "sdg_configuration_tab" %> <%= render Admin::Settings::SDGConfigurationTabComponent.new %>
</div> </div>
</div> </div>