diff --git a/app/views/admin/settings/_map_configuration_tab.html.erb b/app/components/admin/settings/map_tab_component.html.erb similarity index 82% rename from app/views/admin/settings/_map_configuration_tab.html.erb rename to app/components/admin/settings/map_tab_component.html.erb index 38a6f5438..c353d58b3 100644 --- a/app/views/admin/settings/_map_configuration_tab.html.erb +++ b/app/components/admin/settings/map_tab_component.html.erb @@ -1,9 +1,8 @@ <% if feature?(:map) %>

<%= t("admin.settings.index.map.title") %>

- <% tab = "#tab-map-configuration" %> <%= render Admin::Settings::TableComponent.new(setting_name: "setting") do %> - <% %w[map.latitude map.longitude map.zoom].each do |key| %> + <% settings.each do |key| %> <%= render Admin::Settings::RowComponent.new(key, tab: tab) %> <% end %> <% end %> diff --git a/app/components/admin/settings/map_tab_component.rb b/app/components/admin/settings/map_tab_component.rb new file mode 100644 index 000000000..702721eb4 --- /dev/null +++ b/app/components/admin/settings/map_tab_component.rb @@ -0,0 +1,13 @@ +class Admin::Settings::MapTabComponent < ApplicationComponent + def tab + "#tab-map-configuration" + end + + def settings + %w[ + map.latitude + map.longitude + map.zoom + ] + end +end diff --git a/app/views/admin/settings/index.html.erb b/app/views/admin/settings/index.html.erb index 8caea8827..daf1fc2d2 100644 --- a/app/views/admin/settings/index.html.erb +++ b/app/views/admin/settings/index.html.erb @@ -15,7 +15,7 @@
- <%= render "map_configuration_tab" %> + <%= render Admin::Settings::MapTabComponent.new %>